Skip to content

bevy_input_focus: Directional navigation ignores UiTransform #22234

@ickshonpe

Description

@ickshonpe

What problem does this solve or what need does it fill?

bevy_input_focus's directional navigation ignores scaling and rotation of nodes by their UiTransform.
Consider this example:

Image

The black node is our current input focus.
The red node's orientation in the layout generated by Taffy is horizontal (represented by the dashed rectangle) but its UI transform has a rotation giving it a vertical orientation (represented by the solid rectangle). The user sees the red node occupying the position of the solid red rectangle. But the directional navigation plugin ignores its UI transform and builds the navigation tree as though the red node is in it's dashed position.

So the user sees that green node is directly above the input focused black node and when they press the up cursor key they'd expect the input focus to move to the green node, but they reach the red node instead. In the same way, pressing right will move input focus from the black node to the blue node, even though it appears that the red node is between them.

What solution would you like?

Directional navigation should consider the node’s final transformed geometry as seen by the user, rather than the untransformed geometry produced by Taffy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UIGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behaviorS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions