bevyengine / bevyengine/bevy

Provide an ability to define custom bound checking for UI element interaction

Open
#5,180 1 comment 0 reactions 0 assignees View on GitHub
A-UI C-Feature
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

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

Sometimes UI elements might not be rectangular, for example - hexagonal. In such case it would be beneficial if there would be a possibility to have a custom bound checking function to be defined, so that such UI elements could work within the scope of general `ui_focus_system`.

This also includes handling events like `hover` on UI elements with different styling like rotation.

## What solution would you like?

Perhaps, we could provide a component that would contain bound-checking function. This would work for cases where bound checking does not require external information and could be calculated based on `transform` and/or `position`.

No idea how it could be implemented for more generic/complicated bound checking functions that rely on some game state.

## What alternative(s) have you considered?

Another solution would be marking "special" UI elements to be exempt from being handled by internal `ui_focus_system`.
And instead delegate responsibility for doing interactivity in such cases to developers.

Howevers, this approach makes it questionable on how to handle focus policy accross UI.

## Additional context

#5179 - is likely connected issue with this one (they originated from the same conversation).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.