mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
fix: context menu appears at wrong position on first click after canvas move (#7821)
## 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 <!-- Critical design decisions or edge cases that need attention --> <!-- If this PR fixes an issue, uncomment and update the line below --> 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 <drjkl@comfy.org>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user