How to improve diagonal focus selection ?

I think I understand the focus engine pretty well, but I am surprised by some situations still. My biggest issue, is that I have a screen with only UIButtons, and selecting diagonally seems to never quite feel right. To demonstrate what I mean here is a screen shot:


https://s3.amazonaws.com/uploads.hipchat.com/20686/98498/ecU93b81579UAXF/menu.png


Moving from start to the blue dot and back is easily detected. What is never detected is going from blue to the red above it and or any of those buttons to the upper left. However, in a very random bit, sometimes it does go. It seems like the focus engine was only designed for straight up boring grids. ie: Up / left / right / down.


Is there some tricks or other words of advice for supporting diagonal movement? I am tempted to just over ride the entire selection code and force my own via ray casts and dot products. From this screen shot I would expect swiping up to go to any element that is 'above' it. Is there an arc setting that I can widen for its 'search path' ?


Another shortcoming is when I finally get the selection to go to the higher elements, going from green, orange, and red in the middle cluster, rarely occurs. It seems stuck on green orange and the light blue, making red difficult. I would expect swiping right from the green takes me to red. and swiping down from red takes me to the big blue.

Answered by Frameworks Engineer in 105100022

The Focus Engine designed to work best with grid-like layouts where primary movement is up/down/left/right. You can move diagonal as well, though it usually takes a more deliberate swipe, as slightly diaginal swipes will be axis-aligned to make moving in the up/down/left/right directions easier.


Also, when moving up/down/left/right, the Focus Engine searches for a new focused view straight in those directions, not in an arc (i.e. imagine extending a rectangle from the currently focused view to the edge of the screen in the direction of movement – that's similar to the area it searches). If another focusable view is completely diagonal from the currently focused view, it will not be found with straight up/down/left/right movement.


Obviously, this makes the Focus Engine work great with apps that favor a grid-like layout (which is the intention), but for apps that have non-standard layouts, like in your screenshot, it takes more work.


Have you taken a look at the UIFocusGuide class? This allows you to mark arbitrary areas of the screen as focusable using invisible guides, which can then redirect focus to another view. For example, you could use a focus guide, positioned above the center view in your screenshot, to redirect focus left when the user moves up.


Finally, there is not a way for apps to adjust the sensivity, though users can do this to a limited degree in Settings. To request that functionality, as well as anything else you'd like to see in the future, please file a feature request to http://bugreporter.apple.com

Also, the whole thing is waaaaaay too sensitive, is there a way to reduce the sensitivity ?

Accepted Answer

The Focus Engine designed to work best with grid-like layouts where primary movement is up/down/left/right. You can move diagonal as well, though it usually takes a more deliberate swipe, as slightly diaginal swipes will be axis-aligned to make moving in the up/down/left/right directions easier.


Also, when moving up/down/left/right, the Focus Engine searches for a new focused view straight in those directions, not in an arc (i.e. imagine extending a rectangle from the currently focused view to the edge of the screen in the direction of movement – that's similar to the area it searches). If another focusable view is completely diagonal from the currently focused view, it will not be found with straight up/down/left/right movement.


Obviously, this makes the Focus Engine work great with apps that favor a grid-like layout (which is the intention), but for apps that have non-standard layouts, like in your screenshot, it takes more work.


Have you taken a look at the UIFocusGuide class? This allows you to mark arbitrary areas of the screen as focusable using invisible guides, which can then redirect focus to another view. For example, you could use a focus guide, positioned above the center view in your screenshot, to redirect focus left when the user moves up.


Finally, there is not a way for apps to adjust the sensivity, though users can do this to a limited degree in Settings. To request that functionality, as well as anything else you'd like to see in the future, please file a feature request to http://bugreporter.apple.com

How to improve diagonal focus selection ?
 
 
Q