bevy/crates/bevy_ui/src
ickshonpe 1a18c9f87b
UI Debug Overlay show_hidden and show_clipped options (#17097)
# Objective

The UI debug overlay draws an outline for every UI node even if it is
invisible or clipped.
Disable debug outlines for hidden and clipped nodes by default and add
options to renable them if needed.

## Solution

* Add `show_hidden` and `show_clipped` fields to `UiDebugOptions`:
```rust
    /// Show outlines for non-visible UI nodes
    pub show_hidden: bool,
    /// Show outlines for clipped sections of UI nodes
    pub show_clipped: bool,
```

* Only extract debug outlines for hidden and clipped UI nodes if the
respective field in `UiDebugOptions` is set to `true`.

## Testing

Also added some extra features to the `testbed_ui` example that
demonstrate the new options:

cargo run --example testbed_ui --features "bevy_ui_debug"

<img width="641" alt="show-hidden-and-clipped"
src="https://github.com/user-attachments/assets/16a68600-170c-469e-a3c7-f7dae411dc40"
/>
2025-01-02 18:43:14 +00:00
..
experimental Migrate UI bundles to required components (#15898) 2024-10-17 21:11:02 +00:00
layout Refactor and simplify custom projections (#17063) 2025-01-01 20:44:24 +00:00
render UI Debug Overlay show_hidden and show_clipped options (#17097) 2025-01-02 18:43:14 +00:00
widget Move required components doc to type doc (#16575) 2024-12-03 19:45:20 +00:00
accessibility.rs Properly set accessible value on label nodes (#16418) 2024-11-17 18:10:41 +00:00
focus.rs Replace map + unwrap_or(false) with is_some_and (#17067) 2024-12-31 20:28:02 +00:00
geometry.rs Implement FromStr for Val (#16926) 2024-12-24 02:51:13 +00:00
lib.rs Remove the type parameter from check_visibility, and only invoke it once. (#16812) 2024-12-17 04:43:45 +00:00
measurement.rs Use CosmicFontSystem in public bevy_text APIs and remove cosmic_text re-export (#16063) 2024-10-23 20:05:28 +00:00
node_bundles.rs UiImage -> ImageNode, UiImageSize -> ImageNodeSize (#16271) 2024-11-07 21:52:58 +00:00
picking_backend.rs Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
stack.rs Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
ui_material.rs Move required components doc to type doc (#16575) 2024-12-03 19:45:20 +00:00
ui_node.rs Toggleable UI layout rounding (#16841) 2024-12-24 02:41:46 +00:00
update.rs Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00