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

Add a Widget::is_over method which allows a widget to specify when a given point is over it. #925

Closed
mitchmindtree opened this issue Jan 31, 2017 · 1 comment

Comments

@mitchmindtree
Copy link
Contributor

At the moment conrod determines whether or not a point is over a widget by using its bounding-rectangle. This works fine for most widgets that come with conrod as most are the size of their bounding rectangle. This breaks down however when a widget's surface area is any other polygon. E.g. at the moment, a circular button may be pressed by clicking a corner of the button's bounding rectangle, even if that point is not on the visible button itself.

This could be fixed by adding an is_over method to the Widget trait. Arguments should include the widget's bounding Rect, &Widget::State and &Widget::Style. One issue with this approach is that the Widget type itself is not always known when attempting to pick points over widgets. E.g. we need to re-pick which point is under the mouse cursor whenever the mouse is moved. To do this, we need to be able to cast each widget's stored Widget::Style and Widget::State back to their original types, which requires knowing the Widget type itself. Unfortunately the Widget type is only known during widget instantiation. I'm not yet sure how to solve this, any input appreciated!

@mitchmindtree
Copy link
Contributor Author

Closed by #1101.

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