-
Notifications
You must be signed in to change notification settings - Fork 715
Tweak the distance function to prioritize elements that are aligned #3361
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
Comments
Migrated from WICG/spatial-navigation#122 (comment) I've tried a quick and dirty prototype that computes the delta between the desired direction's reference angle and the angle between the currently focused element's centroid and the candidate element's centroid with an arctangent2, and it seems to improve performance a bit. @jihyerish knows how the strawman algorithm works, but the weights and magnitude have to be scaled to match the other ABCD scores in the distance computation phase. Whether or not you factor this in is entirely up to you, but it seems to help. |
Migrated from WICG/spatial-navigation#122 (comment) @hugoholgersson I've been also considering the case that you described above. In your example, if the user presses the down arrow key, from the "XXXXXXX" fragment in the second line the distance value will be calculated. |
Migrated from WICG/spatial-navigation#122 (comment) Probably an edge case worth noting that a horizontally equally sized multiple fragment would need to be handled by using the centroid of the vertical extremas. |
Migrated from WICG/spatial-navigation#122 (comment) I also like the idea of calculating the distances between elements' centroids. But how do we define the centroid of inline elements that span a line break (i.e non-rectangular elements)?
|
Migrated from WICG/spatial-navigation#122 (comment) Taking the centroid of that fragment, you mean? |
Migrated from WICG/spatial-navigation#122 (comment) @hugoholgersson Yes. Because of that, it needs to be defined which fragment to take depending on the input direction. |
Migrated from WICG/spatial-navigation#122 (comment)
We risk a "dead end" when a smaller focusable A sits centered, on top (z-wise) of a bigger focusable B, A->B->A->B->A ... ? |
The issue migration script created some duplicates. #3388 is the same as this one. |
Migrated from WICG/spatial-navigation#122
Originally created by @frivoal on Wed, 17 Oct 2018 05:33:36 GMT
The current distance function behaves somewhat strangely, mostly due to:
B
factor in the formula penalizes elements which are aligned, in a way that is not fully compensated byC
. Both in combination seem to favor elements at 0 or 90 degrees over those at 45 degrees, which does not seem justified.We should:
The text was updated successfully, but these errors were encountered: