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
fix scroll jumps initially to the very end
Roman Pominovb5afe41f96c8
diff --git a/apps/designer/app/shared/design-system/components/primitives/dnd/use-auto-scroll.ts b/apps/designer/app/shared/design-system/components/primitives/dnd/use-auto-scroll.tsindex 71b07fa81f..6830286452 100644--- a/apps/designer/app/shared/design-system/components/primitives/dnd/use-auto-scroll.ts+++ b/apps/designer/app/shared/design-system/components/primitives/dnd/use-auto-scroll.ts@@ -56,7 +56,7 @@ export const useAutoScroll = ({} => {const state = useRef({enabled: false,- prevTimestamp: 0,+ prevTimestamp: undefined as number | undefined,speedX: 0,speedY: 0,stepScheduled: false,@@ -74,6 +74,12 @@ export const useAutoScroll = ({return;}+ if (state.current.prevTimestamp === undefined) {+ state.current.prevTimestamp = timestamp;+ scheduleStep();+ return;+ }+const elapsed = timestamp - state.current.prevTimestamp;if (elapsed < FRAME_PERIOD) {@@ -128,6 +134,7 @@ export const useAutoScroll = ({},setEnabled(newEnabled) {state.current.enabled = newEnabled;+ state.current.prevTimestamp = undefined;scheduleStep();},};