From 23e9b395937e51b3a941b8a4c8549d76dc14bb90 Mon Sep 17 00:00:00 2001 From: newraina Date: Sun, 11 Jan 2026 14:37:50 +0800 Subject: [PATCH] fix: context menu appears at wrong position on first click after canvas move (#7821) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Fixed context menu positioning bug where menu appeared below mouse cursor on first right-click after moving canvas, causing viewport overflow. ## Changes Initialize lastScale/lastOffset* to current canvas transform values when opening menu, preventing updateMenuPosition from overwriting PrimeVue's flip-adjusted position on the first RAF tick. ## Review Focus Fixes #7666 ## Screenshots (if applicable) Please pay attention to the first right-click in each video — that’s where the fix makes a difference. **Before** https://github.com/user-attachments/assets/29621621-a05e-414a-a4cc-5aa5a31b5041 **After** https://github.com/user-attachments/assets/5f46aa69-97a0-44a4-9894-b205fe3d58ed ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7821-fix-context-menu-appears-at-wrong-position-on-first-click-after-canvas-move-2db6d73d365081e4a8ebc0d91e3f927b) by [Unito](https://www.unito.io) Co-authored-by: Alexander Brown --- src/components/graph/NodeContextMenu.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/graph/NodeContextMenu.vue b/src/components/graph/NodeContextMenu.vue index 8382a43ec..97ee1b9c9 100644 --- a/src/components/graph/NodeContextMenu.vue +++ b/src/components/graph/NodeContextMenu.vue @@ -220,6 +220,12 @@ function show(event: MouseEvent) { y: screenY / scale - offset[1] } + // Initialize last* values to current transform to prevent updateMenuPosition + // from overwriting PrimeVue's flip-adjusted position on the first RAF tick + lastScale = scale + lastOffsetX = offset[0] + lastOffsetY = offset[1] + isOpen.value = true contextMenu.value?.show(event) }