prevent element jumping during lasso selection

This commit is contained in:
Ryan Di 2025-08-01 20:19:17 +10:00
parent c715fe4680
commit ec246f90c5

View File

@ -8412,6 +8412,7 @@ class App extends React.Component<AppProps, AppState> {
event.shiftKey && event.shiftKey &&
this.state.selectedLinearElement.elementId === this.state.selectedLinearElement.elementId ===
pointerDownState.hit.element?.id; pointerDownState.hit.element?.id;
if ( if (
(hasHitASelectedElement || (hasHitASelectedElement ||
pointerDownState.hit.hasHitCommonBoundingBoxOfSelectedElements) && pointerDownState.hit.hasHitCommonBoundingBoxOfSelectedElements) &&
@ -8443,6 +8444,15 @@ class App extends React.Component<AppProps, AppState> {
// if elements should be deselected on pointerup // if elements should be deselected on pointerup
pointerDownState.drag.hasOccurred = true; pointerDownState.drag.hasOccurred = true;
// prevent immediate dragging during lasso selection to avoid element displacement
// only allow dragging if we're not in the middle of lasso selection
if (
this.state.activeTool.type === "lasso" &&
this.lassoTrail.hasCurrentTrail
) {
return;
}
// Clear lasso trail when starting to drag selected elements with lasso tool // Clear lasso trail when starting to drag selected elements with lasso tool
// Only clear if we're actually dragging (not during lasso selection) // Only clear if we're actually dragging (not during lasso selection)
if ( if (
@ -8454,16 +8464,6 @@ class App extends React.Component<AppProps, AppState> {
this.lassoTrail.endPath(); this.lassoTrail.endPath();
} }
// prevent immediate dragging during lasso selection to avoid element displacement
// only allow dragging if we're not in the middle of lasso selection
if (
this.state.activeTool.type === "lasso" &&
!this.state.activeTool.fromSelection &&
this.lassoTrail.hasCurrentTrail
) {
return;
}
// prevent dragging even if we're no longer holding cmd/ctrl otherwise // prevent dragging even if we're no longer holding cmd/ctrl otherwise
// it would have weird results (stuff jumping all over the screen) // it would have weird results (stuff jumping all over the screen)
// Checking for editingTextElement to avoid jump while editing on mobile #6503 // Checking for editingTextElement to avoid jump while editing on mobile #6503