Compare commits

...

3 Commits

Author SHA1 Message Date
zsviczian
85ebc4e2f1 lint 2024-05-23 18:07:25 +00:00
zsviczian
c79bb5ed6a changed logic to match regression tests 2024-05-23 18:02:05 +00:00
zsviczian
6ef88eb851 double tap eraser 2024-05-23 17:37:08 +00:00

View File

@ -370,7 +370,11 @@ import {
actionRemoveAllElementsFromFrame,
actionSelectAllElementsInFrame,
} from "../actions/actionFrame";
import { actionToggleHandTool, zoomToFit } from "../actions/actionCanvas";
import {
actionToggleEraserTool,
actionToggleHandTool,
zoomToFit,
} from "../actions/actionCanvas";
import { jotaiStore } from "../jotai";
import { activeConfirmDialogAtom } from "./ActiveConfirmDialog";
import { ImageSceneDataError } from "../errors";
@ -4867,6 +4871,7 @@ class App extends React.Component<AppProps, AppState> {
});
};
private debounceDoubleClickTimestamp: number = 0;
private handleCanvasDoubleClick = (
event: React.MouseEvent<HTMLCanvasElement>,
) => {
@ -4875,6 +4880,23 @@ class App extends React.Component<AppProps, AppState> {
if (this.state.multiElement) {
return;
}
if (
this.state.penMode &&
this.lastPointerDownEvent?.pointerType === "touch" &&
this.state.activeTool.type !== "selection"
) {
const now = Date.now();
if (now - this.debounceDoubleClickTimestamp < 200) {
//handleCanvasDoubleClick click fires twice in case of touch.
//Once from the onTouchStart event handler, once from the double click event handler
return;
}
this.debounceDoubleClickTimestamp = now;
this.updateScene(actionToggleEraserTool.perform([] as any, this.state));
return;
}
// we should only be able to double click when mode is selection
if (this.state.activeTool.type !== "selection") {
return;