mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
renamed handleCanvasPanUsingWheelOrSpaceDragOrRightClickHold to handleCanvasPan and moved the this.handleCanvasContextMenu(
to the end of teardown
This commit is contained in:
parent
ae40c783e8
commit
44fada0cf6
2 changed files with 6 additions and 6 deletions
|
@ -6386,7 +6386,7 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
// we must exit before we set `cursorButton` state and `savePointer`
|
// we must exit before we set `cursorButton` state and `savePointer`
|
||||||
// else it will send pointer state & laser pointer events in collab when
|
// else it will send pointer state & laser pointer events in collab when
|
||||||
// panning
|
// panning
|
||||||
if (this.handleCanvasPanUsingWheelOrSpaceDragOrRightClickHold(event)) {
|
if (this.handleCanvasPan(event)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6709,7 +6709,7 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns whether the event is a panning
|
// Returns whether the event is a panning
|
||||||
public handleCanvasPanUsingWheelOrSpaceDragOrRightClickHold = (
|
public handleCanvasPan = (
|
||||||
event: React.PointerEvent<HTMLElement> | MouseEvent,
|
event: React.PointerEvent<HTMLElement> | MouseEvent,
|
||||||
): boolean => {
|
): boolean => {
|
||||||
const isRightClickDragging = event.button === POINTER_BUTTON.SECONDARY;
|
const isRightClickDragging = event.button === POINTER_BUTTON.SECONDARY;
|
||||||
|
@ -6816,14 +6816,14 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
});
|
});
|
||||||
this.savePointer(event.clientX, event.clientY, "up");
|
this.savePointer(event.clientX, event.clientY, "up");
|
||||||
window.removeEventListener(EVENT.POINTER_MOVE, onPointerMove);
|
window.removeEventListener(EVENT.POINTER_MOVE, onPointerMove);
|
||||||
|
window.removeEventListener(EVENT.POINTER_UP, teardown);
|
||||||
|
window.removeEventListener(EVENT.BLUR, teardown);
|
||||||
|
onPointerMove.flush();
|
||||||
if (!hasDragged && isRightClickDragging) {
|
if (!hasDragged && isRightClickDragging) {
|
||||||
this.handleCanvasContextMenu(
|
this.handleCanvasContextMenu(
|
||||||
event as React.MouseEvent<HTMLElement | HTMLCanvasElement>,
|
event as React.MouseEvent<HTMLElement | HTMLCanvasElement>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
window.removeEventListener(EVENT.POINTER_UP, teardown);
|
|
||||||
window.removeEventListener(EVENT.BLUR, teardown);
|
|
||||||
onPointerMove.flush();
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
window.addEventListener(EVENT.BLUR, teardown);
|
window.addEventListener(EVENT.BLUR, teardown);
|
||||||
|
|
|
@ -640,7 +640,7 @@ export const textWysiwyg = ({
|
||||||
// trying to pan by clicking inside text area itself -> handle here
|
// trying to pan by clicking inside text area itself -> handle here
|
||||||
if (target instanceof HTMLTextAreaElement) {
|
if (target instanceof HTMLTextAreaElement) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
app.handleCanvasPanUsingWheelOrSpaceDragOrRightClickHold(event);
|
app.handleCanvasPan(event);
|
||||||
}
|
}
|
||||||
temporarilyDisableSubmit();
|
temporarilyDisableSubmit();
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue