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
|
<Droppable
|
||||||
droppableId="droppable"
|
droppableId="droppable"
|
||||||
mode="virtual"
|
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
|
<Item
|
||||||
provided={provided}
|
provided={provided}
|
||||||
isDragging={snapshot.isDragging}
|
isDragging={snapshot.isDragging}
|
||||||
item={items[rubric.source.index]}
|
item={items[rubric.source.index]}
|
||||||
style = {{
|
style = {{
|
||||||
|
style
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{provided => (
|
{provided => (
|
||||||
<FixedSizeList
|
<FixedSizeList
|
||||||
|
|||||||
Reference in New Issue
Block a user