Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

optimise swapDropTarget on canvas a bit

Roman Pominov4f0915027447
diff --git a/apps/designer/app/canvas/shared/use-drag-drop.ts b/apps/designer/app/canvas/shared/use-drag-drop.ts
index b1e10e6163..201b5b908b 100644
--- a/apps/designer/app/canvas/shared/use-drag-drop.ts
+++ b/apps/designer/app/canvas/shared/use-drag-drop.ts
@@ -122,7 +122,15 @@ export const useDragAndDrop = () => {
return getDefaultDropTarget();
}
- return { data, element };
+ return {
+ data,
+ element,
+
+ // The only reason we might need to swap again is if we're on the ende of the new target.
+ // But that shouldn't be possible unless we're also on the edge of the current target.
+ // @todo: test this
+ final: dropTarget.area.isNearEdge === false,
+ };
},
onDropTargetChange(dropTarget) {