Skip to content

Commit

Permalink
fix: avoid the right-click menu goes off the screen
Browse files Browse the repository at this point in the history
  • Loading branch information
honorsin committed Sep 29, 2024
1 parent 597139d commit 30eef2f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/suika/src/components/ContextMenu/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const ContextMenu: FC = () => {

if (top < MENU_SPACE_PADDING) {
top = MENU_SPACE_PADDING;
} else if (top + menuSize.height + MENU_SPACE_PADDING > viewportHeight) {
} else if (pos.y + menuSize.height + MENU_SPACE_PADDING > viewportHeight) {
top = viewportHeight - MENU_SPACE_PADDING - menuSize.height;
}

Expand All @@ -82,7 +82,6 @@ export const ContextMenu: FC = () => {
}),
),
);
console.log([pos]);
setVisible(true);
setPos(pos);
}
Expand Down

0 comments on commit 30eef2f

Please sign in to comment.