From a5d60a68ced3d57e0fa84152140600aef0f4b1a7 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Thu, 30 Jan 2025 21:31:41 +0000 Subject: [PATCH] fixed debug overlay --- crates/bevy_ui/src/render/debug_overlay.rs | 52 ++++++++++------------ 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/crates/bevy_ui/src/render/debug_overlay.rs b/crates/bevy_ui/src/render/debug_overlay.rs index 659334f5cccd8..67d527946a529 100644 --- a/crates/bevy_ui/src/render/debug_overlay.rs +++ b/crates/bevy_ui/src/render/debug_overlay.rs @@ -85,34 +85,30 @@ pub fn extract_debug_overlay( }; // Extract a border box to display an outline for every UI Node in the layout - extracted_uinodes.uinodes.insert( - commands.spawn(TemporaryRenderEntity).id(), - ExtractedUiNode { - // Add a large number to the UI node's stack index so that the overlay is always drawn on top - stack_index: uinode.stack_index + u32::MAX / 2, - color: Hsla::sequential_dispersed(entity.index()).into(), - rect: Rect { - min: Vec2::ZERO, - max: uinode.size, - }, - clip: maybe_clip - .filter(|_| !debug_options.show_clipped) - .map(|clip| clip.clip), - image: AssetId::default(), - extracted_camera_entity, - item: ExtractedUiItem::Node { - atlas_scaling: None, - transform: transform.compute_matrix(), - flip_x: false, - flip_y: false, - border: BorderRect::all( - debug_options.line_width / uinode.inverse_scale_factor(), - ), - border_radius: uinode.border_radius(), - node_type: NodeType::Border, - }, - main_entity: entity.into(), + extracted_uinodes.uinodes.push(ExtractedUiNode { + render_entity: commands.spawn(TemporaryRenderEntity).id(), + // Add a large number to the UI node's stack index so that the overlay is always drawn on top + stack_index: uinode.stack_index + u32::MAX / 2, + color: Hsla::sequential_dispersed(entity.index()).into(), + rect: Rect { + min: Vec2::ZERO, + max: uinode.size, }, - ); + clip: maybe_clip + .filter(|_| !debug_options.show_clipped) + .map(|clip| clip.clip), + image: AssetId::default(), + extracted_camera_entity, + item: ExtractedUiItem::Node { + atlas_scaling: None, + transform: transform.compute_matrix(), + flip_x: false, + flip_y: false, + border: BorderRect::all(debug_options.line_width / uinode.inverse_scale_factor()), + border_radius: uinode.border_radius(), + node_type: NodeType::Border, + }, + main_entity: entity.into(), + }); } }