Skip to content

Commit

Permalink
Fix duplicate egui id in the stream trees (rerun-io#8229)
Browse files Browse the repository at this point in the history
Co-authored-by: Emil Ernerfeldt <[email protected]>
  • Loading branch information
abey79 and emilk authored Nov 27, 2024
1 parent 0493fc8 commit 22ee1ae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
14 changes: 11 additions & 3 deletions crates/viewer/re_time_panel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion crates/viewer/re_viewer_context/src/collapsed_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down

0 comments on commit 22ee1ae

Please sign in to comment.