fix: incorrectly erasing on mobile (#4899)

* fix: incorrectly erasing on mobile

* reintroduce fix for erasing on single-point click

* fix snaps
This commit is contained in:
David Luzar 2022-03-11 15:45:59 +01:00 committed by GitHub
parent 7daf1a7944
commit b682d88167
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -2984,7 +2984,21 @@ class App extends React.Component<AppProps, AppState> {
this.lastPointerUp = event; this.lastPointerUp = event;
const isTouchScreen = ["pen", "touch"].includes(event.pointerType); const isTouchScreen = ["pen", "touch"].includes(event.pointerType);
if (isTouchScreen || isEraserActive(this.state)) { if (isTouchScreen) {
const scenePointer = viewportCoordsToSceneCoords(
{ clientX: event.clientX, clientY: event.clientY },
this.state,
);
const hitElement = this.getElementAtPosition(
scenePointer.x,
scenePointer.y,
);
this.hitLinkElement = this.getElementLinkAtPosition(
scenePointer,
hitElement,
);
}
if (isEraserActive(this.state)) {
const scenePointer = viewportCoordsToSceneCoords( const scenePointer = viewportCoordsToSceneCoords(
{ clientX: event.clientX, clientY: event.clientY }, { clientX: event.clientX, clientY: event.clientY },
this.state, this.state,

View File

@ -16860,7 +16860,7 @@ Object {
exports[`regression tests two-finger scroll works: [end of test] number of elements 1`] = `0`; exports[`regression tests two-finger scroll works: [end of test] number of elements 1`] = `0`;
exports[`regression tests two-finger scroll works: [end of test] number of renders 1`] = `16`; exports[`regression tests two-finger scroll works: [end of test] number of renders 1`] = `12`;
exports[`regression tests undo/redo drawing an element: [end of test] appState 1`] = ` exports[`regression tests undo/redo drawing an element: [end of test] appState 1`] = `
Object { Object {