From 22ee1ae7ce98422379a8a63f437db37ad9ca2228 Mon Sep 17 00:00:00 2001 From: Antoine Beyeler <49431240+abey79@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:40:49 +0100 Subject: [PATCH] Fix duplicate egui id in the stream trees (#8229) Co-authored-by: Emil Ernerfeldt --- crates/viewer/re_time_panel/src/lib.rs | 14 +++++++++++--- .../viewer/re_viewer_context/src/collapsed_id.rs | 6 +++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/crates/viewer/re_time_panel/src/lib.rs b/crates/viewer/re_time_panel/src/lib.rs index 1c716f09817a..1b53745c5d35 100644 --- a/crates/viewer/re_time_panel/src/lib.rs +++ b/crates/viewer/re_time_panel/src/lib.rs @@ -547,8 +547,11 @@ impl TimePanel { ui.scroll_with_delta(Vec2::Y * time_area_response.drag_delta().y); } - // Show "/" on top? - let show_root = true; + // Show "/" on top only for recording streams, because the `/` entity in blueprint + // is always empty, so it's just lost space. This works around an issue where the + // selection/hover state of the `/` entity is wrongly synchronized between both + // stores, due to `Item::*` not tracking stores for entity paths. + let show_root = self.source == TimePanelSource::Recording; if show_root { self.show_tree( @@ -632,7 +635,12 @@ impl TimePanel { // Globally unique id - should only be one of these in view at one time. // We do this so that we can support "collapse/expand all" command. - let id = egui::Id::new(CollapseScope::StreamsTree.entity(tree.path.clone())); + let id = egui::Id::new(match self.source { + TimePanelSource::Recording => CollapseScope::StreamsTree.entity(tree.path.clone()), + TimePanelSource::Blueprint => { + CollapseScope::BlueprintStreamsTree.entity(tree.path.clone()) + } + }); let list_item::ShowCollapsingResponse { item_response: response, diff --git a/crates/viewer/re_viewer_context/src/collapsed_id.rs b/crates/viewer/re_viewer_context/src/collapsed_id.rs index ce4f3fc8b31f..6c5e3e7a8a39 100644 --- a/crates/viewer/re_viewer_context/src/collapsed_id.rs +++ b/crates/viewer/re_viewer_context/src/collapsed_id.rs @@ -9,11 +9,15 @@ use crate::{ContainerId, SpaceViewId}; /// The various scopes for which we want to track collapsed state. #[derive(Debug, Clone, Copy, Hash)] +#[allow(clippy::enum_variant_names)] pub enum CollapseScope { /// Stream tree from the time panel StreamsTree, - /// Blueprint tree from the blueprint panel + /// The stream tree from the blueprint debug time panel + BlueprintStreamsTree, + + /// Blueprint tree from the blueprint panel (left panel) BlueprintTree, }