Skip to content

Commit

Permalink
Renames
Browse files Browse the repository at this point in the history
  • Loading branch information
abey79 committed Nov 21, 2024
1 parent e77d326 commit 1e554f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
22 changes: 13 additions & 9 deletions crates/viewer/re_space_view_graph/src/ui/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ pub enum LayoutState {
#[default]
None,
InProgress {
timestamp: Discriminator,
discriminator: Discriminator,
layout: Layout,
provider: ForceLayout,
},
Finished {
timestamp: Discriminator,
discriminator: Discriminator,
layout: Layout,
_provider: ForceLayout,
},
Expand Down Expand Up @@ -132,7 +132,9 @@ impl LayoutState {
) -> Self {
match self {
// Layout is up to date, nothing to do here.
Self::Finished { ref timestamp, .. } if timestamp == &requested => {
Self::Finished {
ref discriminator, ..
} if discriminator == &requested => {
self // no op
}
// We need to recompute the layout.
Expand All @@ -141,34 +143,36 @@ impl LayoutState {
let layout = provider.init_layout();

Self::InProgress {
timestamp: requested,
discriminator: requested,
layout,
provider,
}
}
Self::InProgress { ref timestamp, .. } if timestamp != &requested => {
Self::InProgress {
ref discriminator, ..
} if discriminator != &requested => {
let provider = ForceLayout::new(graphs);
let layout = provider.init_layout();

Self::InProgress {
timestamp: requested,
discriminator: requested,
layout,
provider,
}
}
// We keep iterating on the layout until it is stable.
Self::InProgress {
timestamp,
discriminator,
mut layout,
mut provider,
} => match provider.tick(&mut layout) {
true => Self::Finished {
timestamp,
discriminator,
layout,
_provider: provider,
},
false => Self::InProgress {
timestamp,
discriminator,
layout,
provider,
},
Expand Down
6 changes: 3 additions & 3 deletions crates/viewer/re_space_view_graph/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ Display a graph of nodes and edges.
state.world_bounds = Some(bounds);
let bounds_rect: egui::Rect = bounds.into();

let mut scene = SceneBuilder::from_world_bounds(bounds_rect);
let mut scene_builder = SceneBuilder::from_world_bounds(bounds_rect);

// TODO(grtlr): Is there a blueprint archetype for debug information?
if state.show_debug {
scene.show_debug();
scene_builder.show_debug();
}

let (new_world_bounds, response) = scene.add(ui, |mut scene| {
let (new_world_bounds, response) = scene_builder.add(ui, |mut scene| {
for (entity, graph) in &graphs {
// We use the following to keep track of the bounding box over nodes in an entity.
let mut entity_rect = egui::Rect::NOTHING;
Expand Down

0 comments on commit 1e554f1

Please sign in to comment.