mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-24 01:40:41 +02:00
fix: Jump when cursor not moved
This commit is contained in:
@@ -5960,6 +5960,10 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
|
|
||||||
const scenePointer = viewportCoordsToSceneCoords(event, this.state);
|
const scenePointer = viewportCoordsToSceneCoords(event, this.state);
|
||||||
const { x: scenePointerX, y: scenePointerY } = scenePointer;
|
const { x: scenePointerX, y: scenePointerY } = scenePointer;
|
||||||
|
this.lastPointerMoveCoords = {
|
||||||
|
x: scenePointerX,
|
||||||
|
y: scenePointerY,
|
||||||
|
};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!this.state.newElement &&
|
!this.state.newElement &&
|
||||||
@@ -6177,6 +6181,15 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
: null,
|
: null,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
this.scene.mutateElement(multiElement, {
|
||||||
|
points: [
|
||||||
|
...multiElement.points.slice(0, -1),
|
||||||
|
pointFrom<LocalPoint>(
|
||||||
|
this.lastPointerMoveCoords!.x - multiElement.x,
|
||||||
|
this.lastPointerMoveCoords!.y - multiElement.y,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bindModeHandler = null;
|
this.bindModeHandler = null;
|
||||||
@@ -8624,8 +8637,22 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
pointerDownState.origin.y;
|
pointerDownState.origin.y;
|
||||||
pointerDownState.drag.hasOccurred = true;
|
pointerDownState.drag.hasOccurred = true;
|
||||||
|
|
||||||
|
flushSync(() => {
|
||||||
this.setState(newState);
|
this.setState(newState);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.scene.mutateElement(element, {
|
||||||
|
points: [
|
||||||
|
...element.points.slice(0, -1),
|
||||||
|
pointFrom<LocalPoint>(
|
||||||
|
(this.lastPointerMoveCoords?.x ??
|
||||||
|
pointerDownState.origin.x) - element.x,
|
||||||
|
(this.lastPointerMoveCoords?.y ??
|
||||||
|
pointerDownState.origin.y) - element.y,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bindModeHandler = null;
|
this.bindModeHandler = null;
|
||||||
|
Reference in New Issue
Block a user