I wonder if someone has experience in building use...
# of-graphics
e
I wonder if someone has experience in building user interface navigable without mouse (ex: on TV, game consoles, etc). I remember obsessing over the nav system because pretty much every UI system I worked with required wiring the direction keys manually, and making sure there were no "focus traps", etc. Anyway, this nice simulation of delaunay triangulation gave me the idea of a possible way to wire direction keys automatically. I think some heuristic like this could work: • Make sure every edge between to widgets connected through the euclidean minimum spanning tree is assigned to one of the cardinal directions. • For each widget, fill the rest of the cardinal directions using the relative neighborhood graph, and remembering which widget we "came from" in the opposite direction. As usual, the devil is in the details .... for instance: • I imagine each widget would have to be modeled with a bounding area instead of a single point ... • Care would need to be put if bounding areas overlap ◦ Some widgets may still require tracking its own focus before delegating to the pre-calculated target (for ex., I imagine a scrolling gallery in the middle of the screen surrounded with buttons... 😭) • Etc, etc, etc .... There's a reason most UI frameworks just ask the programmer to do wire navigation by hand 😄
❤️ 6
The reason I think it could work is because, if I get it right, the EMSP tree will never have more than four edges going for any given node (been trying to find that corner case by moving the dots manually 😄 ). Still, there are some cases where assigning cardinal directions to the nodes is not as clear, like in the example below. If the focus starts away from the point marked with the arrow, the directions can be assigned by remembering where the focus came from, and then choosing one edge at the time of the remaining quadrants .... (if that makes sense....). But if the focus starts on the marked item, what does "up" mean? For this particular example, my intuition says "up goes to the closest point", but not sure how that would generalize to any other configuration ... 🤔
❤️ 1
hmmm it seems up/down should consider the vertical distance first, left/right the horizontal one </rant>
l
Imagine it as a physics simulation where there is less resistance along the edges (eg. imagine doing an sdf to all the edges), and pressing up applies more and more up-force on the pointer until it snaps to a new closest node :)
You could then easily plug in different input sources, eg the thinkpad red nibble (sensitive to the full 360deg directional pressure), or multi-directional swipe input (a la appletv controller). If something is close/obvious enough/non-ambiguous/ie. low resistance, navigate without animation; but otherwise communicate the resistance by having it animate fall back. Pressing twice quickly would then give it enough force to overcome it, eg. up up, or up left.
j
You would maybe want to force the connections to T/B/L/R and using curves to connect the nodes. That should be both more aesthetically pleasing and give you a more obvious mapping to arrow keys in all cases.
❤️ 1
w
@Leonard Pauli About applying force, I'm reminded of using arrow keys (just left and right) to navigate a continuum where fine tuning is important and you may want to jump quite far too. One relatively intuitive way is to have alternating left/right presses zero in and continued presses right/right/right increase the distance traveled.
❤️ 1
j
It can also be nice to use modifier keys as magnifiers. (This is how I have configured me editing environment: right arrow moves one character to the right, alt-right moves by a semantic unit -- paragraph, sexp, or whatever, ctrl+right jumps more, ctrl+alt+right jumps more, &c.)
👍 1
w
@Jack Rusher sounds like macOS (alt, ctrl) plus a bit (ctrl+alt).
j
@wtaysom Yeah! Also emacs style (C-b = back one character, M-b back one word, and so on).
w
Yes, of the Emacs bindings, I consistently use C-a and C-e.
s
UIKit’s Focus Engine is surprisingly straightforward and has been battle-tested by lots of developers on tvOS for a few years. Perhaps you can find some inspiration there? https://developer.apple.com/documentation/uikit/focus-based_navigation/about_focus_interactions_for_apple_tv