mirror of
https://github.com/bevyengine/bevy
synced 2024-11-13 00:17:27 +00:00
bca057d7ec
# Objective Problems: * The clipped, non-visible regions of UI nodes are interactive. * `RelativeCursorPostion` is set relative to the visible part of the node. It should be relative to the whole node. * The `RelativeCursorPostion::mouse_over` method returns `true` when the mouse is over a clipped part of a node. fixes #10470 ## Solution Intersect a node's bounding rect with its clipping rect before checking if it contains the cursor. Added the field `normalized_visible_node_rect` to `RelativeCursorPosition`. This is set to the bounds of the unclipped area of the node rect by `ui_focus_system` expressed in normalized coordinates relative to the entire node. Instead of checking if the normalized cursor position lies within a unit square, it instead checks if it is contained by `normalized_visible_node_rect`. Added outlines to the `overflow` example that appear when the cursor is over the visible part of the images, but not the clipped area. --- ## Changelog * `ui_focus_system` intersects a node's bounding rect with its clipping rect before checking if mouse over. * Added the field `normalized_visible_node_rect` to `RelativeCursorPosition`. This is set to the bounds of the unclipped area of the node rect by `ui_focus_system` expressed in normalized coordinates relative to the entire node. * `RelativeCursorPostion` is calculated relative to the whole node's position and size, not only the visible part. * `RelativeCursorPosition::mouse_over` only returns true when the mouse is over an unclipped region of the UI node. * Removed the `Deref` and `DerefMut` derives from `RelativeCursorPosition` as it is no longer a single field struct. * Added some outlines to the `overflow` example that respond to `Interaction` changes. ## Migration Guide The clipped areas of UI nodes are no longer interactive. `RelativeCursorPostion` is now calculated relative to the whole node's position and size, not only the visible part. Its `mouse_over` method only returns true when the cursor is over an unclipped part of the node. `RelativeCursorPosition` no longer implements `Deref` and `DerefMut`. |
||
---|---|---|
.. | ||
borders.rs | ||
button.rs | ||
display_and_visibility.rs | ||
flex_layout.rs | ||
font_atlas_debug.rs | ||
grid.rs | ||
overflow.rs | ||
overflow_debug.rs | ||
relative_cursor_position.rs | ||
size_constraints.rs | ||
text.rs | ||
text_debug.rs | ||
text_wrap_debug.rs | ||
transparency_ui.rs | ||
ui.rs | ||
ui_material.rs | ||
ui_scaling.rs | ||
ui_texture_atlas.rs | ||
viewport_debug.rs | ||
window_fallthrough.rs | ||
z_index.rs |