mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-10-23 08:00:32 +02:00
fix: lasso dragging should snap too
This commit is contained in:
@@ -6601,7 +6601,7 @@ class App extends React.Component<AppProps, AppState> {
|
||||
// For lasso tool, if we hit an element, select it immediately like normal selection
|
||||
if (pointerDownState.hit.element && !hitSelectedElement) {
|
||||
this.setState((prevState) => {
|
||||
let nextSelectedElementIds: { [id: string]: true } = {
|
||||
const nextSelectedElementIds: { [id: string]: true } = {
|
||||
...prevState.selectedElementIds,
|
||||
[pointerDownState.hit.element!.id]: true,
|
||||
};
|
||||
|
@@ -169,8 +169,14 @@ export const isSnappingEnabled = ({
|
||||
selectedElements: NonDeletedExcalidrawElement[];
|
||||
}) => {
|
||||
if (event) {
|
||||
// Allow snapping for lasso tool when dragging selected elements
|
||||
// but not during lasso selection phase
|
||||
const isLassoDragging =
|
||||
app.state.activeTool.type === "lasso" &&
|
||||
app.state.selectedElementsAreBeingDragged;
|
||||
|
||||
return (
|
||||
app.state.activeTool.type !== "lasso" &&
|
||||
(app.state.activeTool.type !== "lasso" || isLassoDragging) &&
|
||||
((app.state.objectsSnapModeEnabled && !event[KEYS.CTRL_OR_CMD]) ||
|
||||
(!app.state.objectsSnapModeEnabled &&
|
||||
event[KEYS.CTRL_OR_CMD] &&
|
||||
|
Reference in New Issue
Block a user