diff --git a/bevy_editor_panes/bevy_2d_viewport/src/lib.rs b/bevy_editor_panes/bevy_2d_viewport/src/lib.rs index 0b2d703..c4c7b85 100644 --- a/bevy_editor_panes/bevy_2d_viewport/src/lib.rs +++ b/bevy_editor_panes/bevy_2d_viewport/src/lib.rs @@ -135,11 +135,14 @@ fn on_pane_creation( } fn update_render_target_size( - query: Query<(Entity, &Bevy2dViewport), Changed>, + query: Query<(Entity, &Bevy2dViewport)>, mut camera_query: Query<(&Camera, &mut EditorCamera2d)>, content: Query<&PaneContentNode>, children_query: Query<&Children>, - pos_query: Query<(&ComputedNode, &GlobalTransform)>, + pos_query: Query< + (&ComputedNode, &GlobalTransform), + Or<(Changed, Changed)>, + >, mut images: ResMut>, ) { for (pane_root, viewport) in &query { @@ -148,8 +151,10 @@ fn update_render_target_size( .find(|e| content.contains(*e)) .unwrap(); + let Ok((computed_node, global_transform)) = pos_query.get(content_node_id) else { + continue; + }; // TODO Convert to physical pixels - let (computed_node, global_transform) = pos_query.get(content_node_id).unwrap(); let content_node_size = computed_node.size(); let node_position = global_transform.translation().xy(); diff --git a/crates/bevy_pane_layout/src/ui.rs b/crates/bevy_pane_layout/src/ui.rs index a7ef16c..0114e21 100644 --- a/crates/bevy_pane_layout/src/ui.rs +++ b/crates/bevy_pane_layout/src/ui.rs @@ -51,6 +51,7 @@ pub(crate) fn spawn_pane<'a>( width: Val::Percent(100.), height: Val::Px(27.), align_items: AlignItems::Center, + flex_shrink: 0., ..default() }, theme.pane_header_background_color, @@ -95,6 +96,10 @@ pub(crate) fn spawn_pane<'a>( font_size: 14., ..default() }, + Node { + flex_shrink: 0., + ..default() + }, )); // Content