renamed handleCanvasPanUsingWheelOrSpaceDragOrRightClickHold to handleCanvasPan and moved the this.handleCanvasContextMenu( to the end of teardown

This commit is contained in:
ColemanDunn 2025-01-27 18:05:43 -07:00
parent ae40c783e8
commit 44fada0cf6
No known key found for this signature in database
2 changed files with 6 additions and 6 deletions

View file

@ -6386,7 +6386,7 @@ class App extends React.Component<AppProps, AppState> {
// we must exit before we set `cursorButton` state and `savePointer`
// else it will send pointer state & laser pointer events in collab when
// panning
if (this.handleCanvasPanUsingWheelOrSpaceDragOrRightClickHold(event)) {
if (this.handleCanvasPan(event)) {
return;
}
@ -6709,7 +6709,7 @@ class App extends React.Component<AppProps, AppState> {
};
// Returns whether the event is a panning
public handleCanvasPanUsingWheelOrSpaceDragOrRightClickHold = (
public handleCanvasPan = (
event: React.PointerEvent<HTMLElement> | MouseEvent,
): boolean => {
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");
window.removeEventListener(EVENT.POINTER_MOVE, onPointerMove);
window.removeEventListener(EVENT.POINTER_UP, teardown);
window.removeEventListener(EVENT.BLUR, teardown);
onPointerMove.flush();
if (!hasDragged && isRightClickDragging) {
this.handleCanvasContextMenu(
event as React.MouseEvent<HTMLElement | HTMLCanvasElement>,
);
}
window.removeEventListener(EVENT.POINTER_UP, teardown);
window.removeEventListener(EVENT.BLUR, teardown);
onPointerMove.flush();
}),
);
window.addEventListener(EVENT.BLUR, teardown);

View file

@ -640,7 +640,7 @@ export const textWysiwyg = ({
// trying to pan by clicking inside text area itself -> handle here
if (target instanceof HTMLTextAreaElement) {
event.preventDefault();
app.handleCanvasPanUsingWheelOrSpaceDragOrRightClickHold(event);
app.handleCanvasPan(event);
}
temporarilyDisableSubmit();
return;