fix: undo when erasing (#4900)

This commit is contained in:
Aakansha Doshi 2022-03-11 20:44:17 +05:30 committed by GitHub
parent b682d88167
commit e92d133973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2999,6 +2999,13 @@ class App extends React.Component<AppProps, AppState> {
); );
} }
if (isEraserActive(this.state)) { if (isEraserActive(this.state)) {
const draggedDistance = distance2d(
this.lastPointerDown!.clientX,
this.lastPointerDown!.clientY,
this.lastPointerUp!.clientX,
this.lastPointerUp!.clientY,
);
if (draggedDistance === 0) {
const scenePointer = viewportCoordsToSceneCoords( const scenePointer = viewportCoordsToSceneCoords(
{ clientX: event.clientX, clientY: event.clientY }, { clientX: event.clientX, clientY: event.clientY },
this.state, this.state,
@ -3010,11 +3017,6 @@ class App extends React.Component<AppProps, AppState> {
const pointerDownEvent = this.initialPointerDownState(event); const pointerDownEvent = this.initialPointerDownState(event);
pointerDownEvent.hit.element = hitElement; pointerDownEvent.hit.element = hitElement;
this.eraseElements(pointerDownEvent); this.eraseElements(pointerDownEvent);
if (isTouchScreen) {
this.hitLinkElement = this.getElementLinkAtPosition(
scenePointer,
hitElement,
);
} }
} }
if ( if (