mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: improving buffer check logic.
This commit is contained in:
parent
e9475f7e34
commit
fd0a53fe02
1 changed files with 5 additions and 6 deletions
|
@ -8109,19 +8109,18 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
const MOVEMENT_BUFFER = 4;
|
const MOVEMENT_BUFFER = 4;
|
||||||
|
|
||||||
// this calculates the buffer for the movement based on the zoom level
|
// 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;
|
||||||
|
|
||||||
if(typeof(ZOOM_RELETIVE_MOVEMENT_BUFFER) === 'number'){
|
console.log(ZOOM_RELETIVE_MOVEMENT_BUFFER); // TODO: remove
|
||||||
|
|
||||||
if (
|
if (
|
||||||
pointDistance(
|
!elementStartedMoving && pointDistance(
|
||||||
pointFrom(pointerCoords.x, pointerCoords.y),
|
pointFrom(pointerCoords.x, pointerCoords.y),
|
||||||
pointFrom(pointerDownState.origin.x, pointerDownState.origin.y),
|
pointFrom(pointerDownState.origin.x, pointerDownState.origin.y),
|
||||||
) < ZOOM_RELETIVE_MOVEMENT_BUFFER && !elementStartedMoving
|
) < ZOOM_RELETIVE_MOVEMENT_BUFFER
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// sets the elementStartedMoving to true so that the buffer is only used once
|
// sets the elementStartedMoving to true so that the buffer is only used once
|
||||||
elementStartedMoving = true;
|
elementStartedMoving = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue