Skip to content

Commit 54e8c12

Browse files
committed
fix multi cursor offscreen bug
1 parent 91ac45d commit 54e8c12

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/core/gridGL/interaction/ViewportEventRegister.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ export const ViewportEventRegister = (props: { viewport: Viewport }) => {
1717

1818
// When the cursor moves ensure it is visible
1919
useEffect(() => {
20-
viewport.ensureVisible(
21-
interactionState.cursorPosition.x * CELL_WIDTH,
22-
interactionState.cursorPosition.y * CELL_HEIGHT - 40,
23-
CELL_WIDTH,
24-
CELL_HEIGHT * 4,
25-
false
26-
);
20+
// When multiCursor is visible don't force the single cursor to be visible
21+
if (!interactionState.showMultiCursor)
22+
viewport.ensureVisible(
23+
interactionState.cursorPosition.x * CELL_WIDTH,
24+
interactionState.cursorPosition.y * CELL_HEIGHT - 40,
25+
CELL_WIDTH,
26+
CELL_HEIGHT * 4,
27+
false
28+
);
2729
}, [viewport, interactionState]);
2830

2931
// register zooming event listener to set Atom state

0 commit comments

Comments
 (0)