Context Menu for snapping view to primary axis planes in 3D plots#6
Context Menu for snapping view to primary axis planes in 3D plots#6AdwaithBatchu wants to merge 3 commits intor3kste:mainfrom
Conversation
r3kste
left a comment
There was a problem hiding this comment.
@AdwaithBatchu The backend implementation is slightly wrong right now. As discussed previously:
- There should be no mention of 3d axes or
view_initwithin the backend files. After all these files should be as general as possible. - You only need to add a function named
context_menuin the FigureManager class.
9e02876 to
2086384
Compare
There was a problem hiding this comment.
@AdwaithBatchu I have some concerns about implementation in Gtk4 and MacOSX.
Apart from that, I want you to link to the official documentation of the context_menu for each backend. For example, I have added a comment for qt backend. Do this for the other implemented backends.
r3kste
left a comment
There was a problem hiding this comment.
@AdwaithBatchu This is pretty close. The main thing is that
Make sure all backends use a consistent method for determining location
1. Current mouse position
2. Extract coords from event
Both will (should) give the exact same output, but for sake of consistency we should use a single method. I think (ii) is better, but let me know if you think otherwise
a2510b9 to
d21caa3
Compare
d21caa3 to
7bb3303
Compare
0ae13f4 to
5417d95
Compare
PR summary
closes 23544
This PR introduces a feature that adds context menu on 3d Axes triggered by right-click of the mouse.
Added
context_menu()in Figure Manager that takes arguments, a list of labels and a list of corresponding functions to execute upon selection.Modified
_button_release()to callcanvas.manager.context_menu()with functions for setting orthographic views when the right-click is released on the mouse without moving it significantly. Mouse movement is handled in_on_move()using a small threshold because previously I observed trackpad (on macOS) reported micro-movements during a static click, which falsely flagged the action as "drag" and blocked the menu in specific backends.Backends
tk.Menuimplementation.QtWidgets.QMenuimplementation.wx.MenuandPopupMenu.Gtk.Menu.Gtk.PopoverMenuandGio.Menu.AppKit(PyObjC) to display a native NSMenu, utilizing a target/action dispatcher.PR checklist