Set isDragging to false when dragging ends
This commit is contained in:
parent
aed1882165
commit
8f659eb975
@ -24,6 +24,7 @@ export default function TableInfo({ data }) {
|
|||||||
const [editField, setEditField] = useState({});
|
const [editField, setEditField] = useState({});
|
||||||
const draggingElementIndex = useRef();
|
const draggingElementIndex = useRef();
|
||||||
const isDragging = useRef();
|
const isDragging = useRef();
|
||||||
|
console.log(isDragging.current);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@ -62,6 +63,7 @@ export default function TableInfo({ data }) {
|
|||||||
onDragOver={(e) => {
|
onDragOver={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (isDragging.current) return;
|
if (isDragging.current) return;
|
||||||
|
console.log("dragging over...");
|
||||||
isDragging.current = true;
|
isDragging.current = true;
|
||||||
draggingElementIndex.current = j;
|
draggingElementIndex.current = j;
|
||||||
}}
|
}}
|
||||||
@ -80,6 +82,10 @@ export default function TableInfo({ data }) {
|
|||||||
updateField(data.id, index, { ...b, id: index });
|
updateField(data.id, index, { ...b, id: index });
|
||||||
updateField(data.id, j, { ...a, id: j });
|
updateField(data.id, j, { ...a, id: j });
|
||||||
}}
|
}}
|
||||||
|
onDragEnd={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
isDragging.current = false;
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<TableField data={f} tid={data.id} index={j} />
|
<TableField data={f} tid={data.id} index={j} />
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user