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

UI Focus System improvements #7689

Closed
wants to merge 1 commit into from
Closed

Conversation

valaphee
Copy link
Contributor

@valaphee valaphee commented Feb 15, 2023

Objective

At the moment the position where a click has occurred has to be manually tracked.

Solution

This PR makes the process easier, by providing the position where the button has clicked, not changing while it is clicked (in contrast to RelativeCursorPosition). It also improves the understand-ability/readability of the ui_focus_system by getting rid of the partial-read iterator, replacing it with easy-readable if statements.

Changelog

  • added Vec2(position of the click) to Interaction::Clicked

Migration Guide

  • replace *interaction == Interaction::Clicked with matches!(*interaction, Interaction::Clicked(_))

@valaphee
Copy link
Contributor Author

valaphee commented Feb 15, 2023

It also might be a good idea to use non-normalized positions in the RelativeCursorPosition component, or normalized positions in the Interaction::Clicked

@alice-i-cecile alice-i-cecile added A-UI Graphical user interfaces, styles, layouts, and widgets C-Usability A simple quality-of-life change that makes Bevy easier to use C-Code-Quality A section of code that is hard to understand or change labels Feb 15, 2023
@valaphee valaphee closed this Jun 6, 2023
@valaphee valaphee deleted the focus branch June 6, 2023 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Code-Quality A section of code that is hard to understand or change C-Usability A simple quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants