From fd0a53fe024358bc644cf8e45a39258db9d9a791 Mon Sep 17 00:00:00 2001 From: Pahul Gogna <135852041+PahulGogna@users.noreply.github.com> Date: Wed, 11 Dec 2024 01:10:42 +0530 Subject: [PATCH] fix: improving buffer check logic. --- packages/excalidraw/components/App.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsx index 8b2175d5b..2a4c2c869 100644 --- a/packages/excalidraw/components/App.tsx +++ b/packages/excalidraw/components/App.tsx @@ -8109,19 +8109,18 @@ class App extends React.Component { const MOVEMENT_BUFFER = 4; // this calculates the buffer for the movement based on the zoom level - const ZOOM_RELETIVE_MOVEMENT_BUFFER = MOVEMENT_BUFFER / this.state.zoom.value; + const ZOOM_RELETIVE_MOVEMENT_BUFFER: number = MOVEMENT_BUFFER / this.state.zoom.value; + + console.log(ZOOM_RELETIVE_MOVEMENT_BUFFER); // TODO: remove - if(typeof(ZOOM_RELETIVE_MOVEMENT_BUFFER) === 'number'){ - if ( - pointDistance( + !elementStartedMoving && pointDistance( pointFrom(pointerCoords.x, pointerCoords.y), pointFrom(pointerDownState.origin.x, pointerDownState.origin.y), - ) < ZOOM_RELETIVE_MOVEMENT_BUFFER && !elementStartedMoving + ) < ZOOM_RELETIVE_MOVEMENT_BUFFER ) { return; } - } // sets the elementStartedMoving to true so that the buffer is only used once elementStartedMoving = true;