fix: undo when erasing (#4900)
This commit is contained in:
parent
b682d88167
commit
e92d133973
@ -2999,22 +2999,24 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (isEraserActive(this.state)) {
|
if (isEraserActive(this.state)) {
|
||||||
const scenePointer = viewportCoordsToSceneCoords(
|
const draggedDistance = distance2d(
|
||||||
{ clientX: event.clientX, clientY: event.clientY },
|
this.lastPointerDown!.clientX,
|
||||||
this.state,
|
this.lastPointerDown!.clientY,
|
||||||
|
this.lastPointerUp!.clientX,
|
||||||
|
this.lastPointerUp!.clientY,
|
||||||
);
|
);
|
||||||
const hitElement = this.getElementAtPosition(
|
if (draggedDistance === 0) {
|
||||||
scenePointer.x,
|
const scenePointer = viewportCoordsToSceneCoords(
|
||||||
scenePointer.y,
|
{ clientX: event.clientX, clientY: event.clientY },
|
||||||
);
|
this.state,
|
||||||
const pointerDownEvent = this.initialPointerDownState(event);
|
|
||||||
pointerDownEvent.hit.element = hitElement;
|
|
||||||
this.eraseElements(pointerDownEvent);
|
|
||||||
if (isTouchScreen) {
|
|
||||||
this.hitLinkElement = this.getElementLinkAtPosition(
|
|
||||||
scenePointer,
|
|
||||||
hitElement,
|
|
||||||
);
|
);
|
||||||
|
const hitElement = this.getElementAtPosition(
|
||||||
|
scenePointer.x,
|
||||||
|
scenePointer.y,
|
||||||
|
);
|
||||||
|
const pointerDownEvent = this.initialPointerDownState(event);
|
||||||
|
pointerDownEvent.hit.element = hitElement;
|
||||||
|
this.eraseElements(pointerDownEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user