From 54e8c127b31175c2ab249b09094dee4762993abe Mon Sep 17 00:00:00 2001 From: David Kircos Date: Mon, 23 May 2022 11:39:38 -0600 Subject: [PATCH] fix multi cursor offscreen bug --- .../gridGL/interaction/ViewportEventRegister.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/core/gridGL/interaction/ViewportEventRegister.tsx b/src/core/gridGL/interaction/ViewportEventRegister.tsx index 9d1f489f6a..bb4526a23a 100644 --- a/src/core/gridGL/interaction/ViewportEventRegister.tsx +++ b/src/core/gridGL/interaction/ViewportEventRegister.tsx @@ -17,13 +17,15 @@ export const ViewportEventRegister = (props: { viewport: Viewport }) => { // When the cursor moves ensure it is visible useEffect(() => { - viewport.ensureVisible( - interactionState.cursorPosition.x * CELL_WIDTH, - interactionState.cursorPosition.y * CELL_HEIGHT - 40, - CELL_WIDTH, - CELL_HEIGHT * 4, - false - ); + // When multiCursor is visible don't force the single cursor to be visible + if (!interactionState.showMultiCursor) + viewport.ensureVisible( + interactionState.cursorPosition.x * CELL_WIDTH, + interactionState.cursorPosition.y * CELL_HEIGHT - 40, + CELL_WIDTH, + CELL_HEIGHT * 4, + false + ); }, [viewport, interactionState]); // register zooming event listener to set Atom state