Skip to content
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

Wrong order when using Tab navigation (and possible fix) #101

Open
gebalassa opened this issue Nov 14, 2022 · 0 comments
Open

Wrong order when using Tab navigation (and possible fix) #101

gebalassa opened this issue Nov 14, 2022 · 0 comments

Comments

@gebalassa
Copy link

gebalassa commented Nov 14, 2022

Something with using the custom GetScreenCoordinates() function in CompareTo() messes with Tab navigation due to bad sort().

I replaced the original CompareTo() function with:

// Get screen space coordinates for both WebGLInput objects, then prioritize by Y-coord, then by X-coord.
public int CompareTo(WebGLInput other)
{
    var a = Camera.main.WorldToScreenPoint(input.RectTransform().position);
    var b = Camera.main.WorldToScreenPoint(other.input.RectTransform().position);
    var res = b.y.CompareTo(a.y);
    if (res == 0) res = a.x.CompareTo(b.x);
    return res;
}

Not sure if this messes something else up, but my Tab navigation is working perfectly now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant