Skip to content

Conversation

@ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Nov 24, 2025

Objective

  • Allow setting the UI debug outline options for individual nodes.
  • Add options to render outlines for the padding-box, content-box and scrollbar regions of UI nodes.
  • Add an option to ignore border radius and render the node outlines without curved corners.

Solution

  • Expand UiDebugOptions to include fields to control the new features:
pub struct UiDebugOptions {
    /// Set to true to enable the UI debug overlay
    pub enabled: bool,
    /// Show outlines for the border boxes of UI nodes
    pub outline_border_box: bool,
    /// Show outlines for the padding boxes of UI nodes
    pub outline_padding_box: bool,
    /// Show outlines for the content boxes of UI nodes
    pub outline_content_box: bool,
    /// Show outlines for the scrollbar regions of UI nodes
    pub outline_scrollbars: bool,
    /// Width of the overlay's lines in logical pixels
    pub line_width: f32,
    /// Show outlines for non-visible UI nodes
    pub show_hidden: bool,
    /// Show outlines for clipped sections of UI nodes
    pub show_clipped: bool,
    /// Draw outlines without curved corners
    pub ignore_border_radius: bool,
}

By default, only outline_border_box is enabled, matching the original behaviour before this PR.

  • Update extract_debug_overlay to add rendering for the new features.
  • Derive Component for UiDebugOptions, as well as Resource. As a Resource it sets the options globally. As a Component it overrides the resource, to control the options locally for an individual UiNode.

Testing

Added debug outlines to the scroll example to display the scrollbar bounds for the vertically scrolling list on the left when debug outlines are enabled, run with:

cargo run --example scroll --features="bevy_ui_debug"

Showcase

Screenshot 2025-11-24 110004

* `show_padding_box`
* `show_content_box`
* `show_scrollbars`
* `ignore_border_radius`

Implemented support for the `ignore_border_radius` option.
`UiDebugOptions` is now both a `Component` and `Resource`, add it as a component to override the options from the resource for an individual UI node.
* Moved debug options enabled check inside uinode loop
@ickshonpe ickshonpe changed the title UiDebugOverlay improvements New UiDebugOverlay features Nov 24, 2025
@ickshonpe ickshonpe added C-Feature A new feature, making something new possible A-UI Graphical user interfaces, styles, layouts, and widgets C-Testing A change that impacts how we test Bevy or how users test their apps D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Rendering Drawing game state to the screen labels Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible C-Testing A change that impacts how we test Bevy or how users test their apps D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant