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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
handle onEnd
Oleg Isonen590cbf07f896
diff --git a/apps/designer/app/shared/design-system/components/primitives/dnd/handlers.stories.tsx b/apps/designer/app/shared/design-system/components/primitives/dnd/handlers.stories.tsxindex 4f875551c0..5ce61817c1 100644--- a/apps/designer/app/shared/design-system/components/primitives/dnd/handlers.stories.tsx+++ b/apps/designer/app/shared/design-system/components/primitives/dnd/handlers.stories.tsx@@ -33,6 +33,10 @@ export const Playground = () => {}},onMove: handleMove,+ onEnd() {+ setDropTargetRect(undefined);+ setPlacementIndicatorRect(undefined);+ },});return (diff --git a/apps/designer/app/shared/design-system/components/primitives/dnd/use-drag.ts b/apps/designer/app/shared/design-system/components/primitives/dnd/use-drag.tsindex ae62b50e36..cca4170964 100644--- a/apps/designer/app/shared/design-system/components/primitives/dnd/use-drag.ts+++ b/apps/designer/app/shared/design-system/components/primitives/dnd/use-drag.ts@@ -19,14 +19,17 @@ type State =status: "canceled";};+const initialState = {+ status: "idle",+} as const;+export const useDrag = ({- onStart,startDistanceThreashold = 3,+ onStart,onMove,+ onEnd,}: any = {}) => {- const state = useRef<State>({- status: "idle",- });+ const state = useRef<State>(initialState);const cancel = () => {state.current = { status: "canceled" };@@ -72,7 +75,8 @@ export const useDrag = ({onMove({ x: pageX, y: pageY });},onMoveEnd() {- state.current.status = "idle";+ state.current = initialState;+ onEnd();},});