fix: improve ctrl+alt lasso selecting (#9514)

This commit is contained in:
David Luzar 2025-05-12 18:09:37 +02:00 committed by GitHub
parent 35bb449a4b
commit 298812e1d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 11 deletions

View File

@ -7276,8 +7276,13 @@ class App extends React.Component<AppProps, AppState> {
}); });
// If we click on something // If we click on something
} else if (hitElement != null) { } else if (hitElement != null) {
// == deep selection ==
// on CMD/CTRL, drill down to hit element regardless of groups etc. // on CMD/CTRL, drill down to hit element regardless of groups etc.
if (event[KEYS.CTRL_OR_CMD]) { if (event[KEYS.CTRL_OR_CMD]) {
if (event.altKey) {
// ctrl + alt means we're lasso selecting
return false;
}
if (!this.state.selectedElementIds[hitElement.id]) { if (!this.state.selectedElementIds[hitElement.id]) {
pointerDownState.hit.wasAddedToSelection = true; pointerDownState.hit.wasAddedToSelection = true;
} }
@ -8636,6 +8641,7 @@ 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,
@ -8648,6 +8654,7 @@ class App extends React.Component<AppProps, AppState> {
this.setAppState({ this.setAppState({
selectionElement: null, selectionElement: null,
}); });
});
} else { } else {
this.maybeDragNewGenericElement(pointerDownState, event); this.maybeDragNewGenericElement(pointerDownState, event);
} }

View File

@ -173,6 +173,8 @@ export const isSnappingEnabled = ({
(app.state.objectsSnapModeEnabled && !event[KEYS.CTRL_OR_CMD]) || (app.state.objectsSnapModeEnabled && !event[KEYS.CTRL_OR_CMD]) ||
(!app.state.objectsSnapModeEnabled && (!app.state.objectsSnapModeEnabled &&
event[KEYS.CTRL_OR_CMD] && event[KEYS.CTRL_OR_CMD] &&
// ctrl + alt means we're lasso selecting
!event.altKey &&
!isGridModeEnabled(app)) !isGridModeEnabled(app))
); );
} }