-
Notifications
You must be signed in to change notification settings - Fork 920
Added keybindings to move the maven dependency graph with cursor keys around and zoom in and out. #9161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Also added keybindings and mouse wheel listener to zoom in (CTRL + +) and zoom out (CTRL + -).
mbien
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is probably an area which can be improved but the current PR has a few problems and overwrites existing functionality you might not be aware of.
zoom:
Mouse wheel zoom is already implemented (ctrl+wheel). It is zooms to the mouse pointer location commonly seen on maps/graphs etc. This PR overwrites this functionality and makes it worse since it doesn't take the mouse pointer as zoom point into account.
navigation:
Once a tree component had focus, arrow keys will move the item selection around, I couldn't get the focus back to the graph to move it with arrow keys.
Middle mouse drag is also already implemented btw
UI:
The tool tips should use the same format used for other actions. They usually follow the Name [hotkey] pattern like:

instead of

There is also a utility which can generate the hotkey text, it might work here too, example:
netbeans/platform/favorites/src/org/netbeans/modules/favorites/Tab.java
Lines 242 to 247 in 2fba977
| String hotkey = ""; // NOI18N | |
| Action action = org.openide.awt.Actions.forID("Window/SelectDocumentNode", "org.netbeans.modules.favorites.Select"); // NOI18N | |
| if (action != null && action.getValue(Action.ACCELERATOR_KEY) instanceof KeyStroke ks) { | |
| hotkey = org.openide.awt.Actions.keyStrokeToString(ks); | |
| } | |
| setToolTipText(NbBundle.getMessage(Tab.class, "TT_Favorites", hotkey)); //NOI18N |
neilcsmith-net
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @mbien that there are a number of issues that need addressing here.
Moving the scene by arrow keys should work using the bindings in the scroll pane UI, as long as the scene view has focus. The request focus call here is probably all that is needed for that to work. At least, it's working in a platform application.
Should add the wheel pan action too - https://bits.netbeans.org/29/javadoc/org-netbeans-api-visual/org/netbeans/api/visual/action/ActionFactory.html#createWheelPanAction()
Zoom actions are better registered globally somewhere IMO using callback action registrations. This would allow better integration with the shortcuts system, and we can look to migrate other internal uses (eg. image viewer). I did this recently in a platform application - see praxis-live/praxis-live@ded66c8
Also, CTRL should never be hardcoded as a shortcut trigger due to macOS.
for keyboard navigation and changed the tooltips.
|
I was indeed neither aware of mouse wheel zoom nor middle mouse dragging. The shortcut for zooming in and out was changed from CTRL+[+/-] to Alt+[+/-]. My question is: is this okay or should I use another shortcut (or should I also remove this part)?
I could not reproduce this behavior. Even though I select a node and press then a cursor key the whole graph is moved, not a single node. |
Also added keybindings and mouse wheel listener to zoom in (CTRL + +) and zoom out (CTRL + -).
^Add meaningful description above
Click to collapse/expand PR instructions
By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -
Please make sure (eg.
git log) that all commits have a valid name and email address for you in the Author field.If you're a first time contributor, see the Contributing guidelines for more information.
If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.
PR approval and merge checklist:
If this PR targets the delivery branch: don't merge. (full wiki article)