fix(Happy Hare): Fixes display of gate-context menus with right-click action#1757
Conversation
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
| <v-list dense> | ||
| <v-list | ||
| dense | ||
| @mouseleave="closeContextMenu" |
There was a problem hiding this comment.
The mouseleave event on the v-list will close the menu when the user's cursor briefly leaves the menu bounds, which can be frustrating. This conflicts with the 6-second timeout mechanism. Consider removing the mouseleave handler or add a small delay before closing to prevent accidental closure when the user's cursor momentarily leaves the menu area.
There was a problem hiding this comment.
Assume intended behavior, so ignore.
| contextMenuCommand (command: string, loading: string, gate: number) { | ||
| this.sendGcode(`${command} GATE=${gate}`, loading) | ||
| } |
There was a problem hiding this comment.
After executing a command, the context menu should close but there's no call to closeContextMenu in contextMenuCommand. This means the menu stays open after clicking a button, which is counterintuitive. Add a call to this.closeContextMenu() at the end of contextMenuCommand to close the menu after executing the command.
There was a problem hiding this comment.
This seems to be the expected behavior, so ignore.
| this.menuX = e.clientX - 20 | ||
| this.menuY = e.clientY - 20 |
There was a problem hiding this comment.
The magic numbers -20 for menu positioning offset are unexplained. Extract these to named constants with descriptive names to improve code maintainability and make the offset purpose clear.
| this.$set(this.gateMenuVisible, gate, true) | ||
| this.closeTimeout = window.setTimeout(() => { | ||
| this.closeContextMenu() | ||
| }, 6000) |
There was a problem hiding this comment.
The magic number 6000 (6 seconds timeout) is unexplained. Extract this to a named constant with a descriptive name to improve code maintainability and make the timeout duration clear and easily configurable.
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Description:
Previously the included gate context menus were not being displayed. This fixes that and make the menu mechanism more extensible.
The context menus are require to be able to perform operations on gates other than the one selected. E.g. on a Type-B MMU like BoxTurtle, KMS, QuattroBox, etc for ejecting or pre-loading gates/lanes:
SIgned off by: Paul Morgan (moggieuk@hotmail.com)