mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-21 00:10:33 +02:00
fix: Jump when cursor not moved
This commit is contained in:
@@ -5935,6 +5935,10 @@ class App extends React.Component<AppProps, AppState> {
|
||||
|
||||
const scenePointer = viewportCoordsToSceneCoords(event, this.state);
|
||||
const { x: scenePointerX, y: scenePointerY } = scenePointer;
|
||||
this.lastPointerMoveCoords = {
|
||||
x: scenePointerX,
|
||||
y: scenePointerY,
|
||||
};
|
||||
|
||||
if (
|
||||
!this.state.newElement &&
|
||||
@@ -6152,6 +6156,15 @@ class App extends React.Component<AppProps, AppState> {
|
||||
: 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;
|
||||
@@ -8599,8 +8612,22 @@ class App extends React.Component<AppProps, AppState> {
|
||||
pointerDownState.origin.y;
|
||||
pointerDownState.drag.hasOccurred = true;
|
||||
|
||||
this.setState(newState);
|
||||
flushSync(() => {
|
||||
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;
|
||||
|
Reference in New Issue
Block a user