Select the neighboring shape with Ctrl+Arrow keys (spatial navigation on the canvas) #2691
Closed
kimchioverfit
started this conversation in
Ideas / Feature requests
Replies: 1 comment
|
I've opened #2692 implementing this so it can be tried out directly; |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Motivation
When an image has many shapes, switching the selected shape by mouse is slow: small or overlapping objects are hard to click precisely, and the Polygon Labels list can only be walked in list order (Up/Down), which has nothing to do with where the shapes are on screen. I often want to say "go to the shape to the right of this one" without leaving the keyboard.
Proposal
In edit mode, with a shape selected:
The new bindings would be added to shortcuts: in default_config.yaml (e.g. select_shape_left, select_shape_right, select_shape_up, select_shape_down) so users can rebind or disable them like every other shortcut.
Why a modifier
Plain arrow keys already nudge the selected shape by 5 px in edit mode (#269, #942, recently refactored in #2673), and Up/Down navigate the file list and the label dialog (#96, #2434). So this needs a modifier to avoid colliding with existing behavior. Ctrl+ is unused today and doesn't clash with anything in the shortcut table. I'd avoid Alt+ (some window managers / Windows conventions grab it) and would leave Shift+ free in case a "larger nudge" is ever wanted.
Selection rule (draft)
Compare bounding-box centers. For Ctrl+Right, candidates are shapes whose center has dx > 0 relative to the current shape; pick the one minimizing dx + 2 * |dy| (the perpendicular term keeps the result in the same "row" instead of jumping diagonally). Same for the other three directions with axes swapped. If there is no candidate in that direction, keep the current selection. Hidden shapes are skipped.
Related
All previous arrow-key threads I could find are about moving a shape (#269, #942, #1457, #2375, #2398, #2673) or navigating lists (#96, #862, #2433, #2434). I didn't find any existing request for spatial navigation between shapes.
I'm happy to open a PR for this if the idea is welcome — the natural place looks like Canvas.keyPressEvent, next to the existing arrow-key nudge branch.
All reactions