fix: erase all elements which are hit with single point click (#4934)
This commit is contained in:
parent
8c0a0415de
commit
ceb43ed8fb
@ -4441,12 +4441,15 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
},
|
},
|
||||||
this.state,
|
this.state,
|
||||||
);
|
);
|
||||||
const hitElement = this.getElementAtPosition(
|
const hitElements = this.getElementsAtPosition(
|
||||||
scenePointer.x,
|
scenePointer.x,
|
||||||
scenePointer.y,
|
scenePointer.y,
|
||||||
);
|
);
|
||||||
|
|
||||||
pointerDownState.hit.element = hitElement;
|
hitElements.forEach(
|
||||||
|
(hitElement) =>
|
||||||
|
(pointerDownState.elementIdsToErase[hitElement.id] = true),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
this.eraseElements(pointerDownState);
|
this.eraseElements(pointerDownState);
|
||||||
return;
|
return;
|
||||||
@ -4592,16 +4595,12 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private eraseElements = (pointerDownState: PointerDownState) => {
|
private eraseElements = (pointerDownState: PointerDownState) => {
|
||||||
const hitElement = pointerDownState.hit.element;
|
|
||||||
const elements = this.scene.getElements().map((ele) => {
|
const elements = this.scene.getElements().map((ele) => {
|
||||||
if (pointerDownState.elementIdsToErase[ele.id]) {
|
if (pointerDownState.elementIdsToErase[ele.id]) {
|
||||||
return newElementWith(ele, { isDeleted: true });
|
return newElementWith(ele, { isDeleted: true });
|
||||||
} else if (hitElement && ele.id === hitElement.id) {
|
|
||||||
return newElementWith(ele, { isDeleted: true });
|
|
||||||
} else if (
|
} else if (
|
||||||
isBoundToContainer(ele) &&
|
isBoundToContainer(ele) &&
|
||||||
(pointerDownState.elementIdsToErase[ele.containerId] ||
|
pointerDownState.elementIdsToErase[ele.containerId]
|
||||||
(hitElement && ele.containerId === hitElement.id))
|
|
||||||
) {
|
) {
|
||||||
return newElementWith(ele, { isDeleted: true });
|
return newElementWith(ele, { isDeleted: true });
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user