mirror of
https://github.com/excalidraw/excalidraw
synced 2025-07-25 13:58:22 +08:00
fix: Remove flushSync from alt-lasso and elbow dragging (#9734)
* Remove lasso flushSync * Remove selectedLinearElement flushSync * Early return
This commit is contained in:
@ -8095,16 +8095,12 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
this.scene,
|
this.scene,
|
||||||
);
|
);
|
||||||
|
|
||||||
flushSync(() => {
|
this.setState({
|
||||||
if (this.state.selectedLinearElement) {
|
selectedLinearElement: {
|
||||||
this.setState({
|
...this.state.selectedLinearElement,
|
||||||
selectedLinearElement: {
|
segmentMidPointHoveredCoords: ret.segmentMidPointHoveredCoords,
|
||||||
...this.state.selectedLinearElement,
|
pointerDownState: ret.pointerDownState,
|
||||||
segmentMidPointHoveredCoords: ret.segmentMidPointHoveredCoords,
|
},
|
||||||
pointerDownState: ret.pointerDownState,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -8618,23 +8614,21 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
pointerDownState.lastCoords.x = pointerCoords.x;
|
pointerDownState.lastCoords.x = pointerCoords.x;
|
||||||
pointerDownState.lastCoords.y = pointerCoords.y;
|
pointerDownState.lastCoords.y = pointerCoords.y;
|
||||||
if (event.altKey) {
|
if (event.altKey) {
|
||||||
flushSync(() => {
|
this.setActiveTool(
|
||||||
this.setActiveTool(
|
{ type: "lasso", fromSelection: true },
|
||||||
{ type: "lasso", fromSelection: true },
|
event.shiftKey,
|
||||||
event.shiftKey,
|
);
|
||||||
);
|
this.lassoTrail.startPath(
|
||||||
this.lassoTrail.startPath(
|
pointerDownState.origin.x,
|
||||||
pointerDownState.origin.x,
|
pointerDownState.origin.y,
|
||||||
pointerDownState.origin.y,
|
event.shiftKey,
|
||||||
event.shiftKey,
|
);
|
||||||
);
|
this.setAppState({
|
||||||
this.setAppState({
|
selectionElement: null,
|
||||||
selectionElement: null,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} else {
|
return;
|
||||||
this.maybeDragNewGenericElement(pointerDownState, event);
|
|
||||||
}
|
}
|
||||||
|
this.maybeDragNewGenericElement(pointerDownState, event);
|
||||||
} else if (this.state.activeTool.type === "lasso") {
|
} else if (this.state.activeTool.type === "lasso") {
|
||||||
if (!event.altKey && this.state.activeTool.fromSelection) {
|
if (!event.altKey && this.state.activeTool.fromSelection) {
|
||||||
this.setActiveTool({ type: "selection" });
|
this.setActiveTool({ type: "selection" });
|
||||||
|
Reference in New Issue
Block a user