Drag only on vertical axis
Made this change a while ago, but didn't push since it looks like we might switch to Elie's DnD. Pushing since it looks like there might still be reviewers.
This commit is contained in:
@@ -109,16 +109,34 @@ const List: React.FC<ListProps> = ({
|
||||
<Droppable
|
||||
droppableId="droppable"
|
||||
mode="virtual"
|
||||
renderClone={(provided, snapshot, rubric) => (
|
||||
direction="vertical"
|
||||
renderClone={(provided, snapshot, rubric) => {
|
||||
let { style } = provided.draggableProps;
|
||||
const transform = style?.transform;
|
||||
|
||||
if (snapshot.isDragging && transform) {
|
||||
let [x, y] = transform
|
||||
.replace('translate(', '')
|
||||
.replace(')', '')
|
||||
.split(',')
|
||||
.map((v) => parseInt(v, 10));
|
||||
|
||||
style.transform = `translate(0px, ${y}px)`;
|
||||
}
|
||||
|
||||
style.fontFamily = "Inter";
|
||||
|
||||
return (
|
||||
<Item
|
||||
provided={provided}
|
||||
isDragging={snapshot.isDragging}
|
||||
item={items[rubric.source.index]}
|
||||
style = {{
|
||||
|
||||
style
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
}
|
||||
>
|
||||
{provided => (
|
||||
<FixedSizeList
|
||||
|
||||
Reference in New Issue
Block a user