Skip to content

Commit

Permalink
Remove debug information from graph view selection panel (#8496)
Browse files Browse the repository at this point in the history
### What

Title.

This was a small part of @gavrelina's feedback.


<!--
Make sure the PR title and labels are set to maximize their usefulness
for the CHANGELOG,
and our `git log`.

If you have noticed any breaking changes, include them in the migration
guide.

We track various metrics at <https://build.rerun.io>.

For maintainers:
* To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
* To deploy documentation changes immediately after merging this PR, add
the `deploy docs` label.
-->
  • Loading branch information
grtlr authored Dec 17, 2024
1 parent 11c06b1 commit 7781de0
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 39 deletions.
22 changes: 0 additions & 22 deletions crates/viewer/re_view_graph/src/ui/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,28 +221,6 @@ fn draw_node(
node_ui.response()
}

/// Draws a bounding box, as well as a basic coordinate system.
pub fn draw_debug(ui: &Ui, world_bounding_rect: Rect) {
let painter = ui.painter();

// Paint coordinate system at the world origin
let origin = Pos2::new(0.0, 0.0);
let x_axis = Pos2::new(100.0, 0.0);
let y_axis = Pos2::new(0.0, 100.0);

painter.line_segment([origin, x_axis], Stroke::new(1.0, Color32::RED));
painter.line_segment([origin, y_axis], Stroke::new(1.0, Color32::GREEN));

if world_bounding_rect.is_positive() {
painter.rect(
world_bounding_rect,
0.0,
Color32::from_rgba_unmultiplied(255, 0, 255, 8),
Stroke::new(1.0, Color32::from_rgb(255, 0, 255)),
);
}
}

/// Helper function to draw an arrow at the end of the edge
fn draw_arrow(painter: &Painter, tip: Pos2, direction: Vec2, color: Color32) {
let arrow_size = 10.0; // Adjust size as needed
Expand Down
2 changes: 1 addition & 1 deletion crates/viewer/re_view_graph/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ mod draw;
mod selection;
mod state;

pub use draw::{draw_debug, draw_graph, DrawableLabel, LevelOfDetail};
pub use draw::{draw_graph, DrawableLabel, LevelOfDetail};
pub use selection::view_property_force_ui;
pub use state::GraphViewState;
9 changes: 0 additions & 9 deletions crates/viewer/re_view_graph/src/ui/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ use crate::layout::{ForceLayoutParams, ForceLayoutProvider, Layout, LayoutReques
#[derive(Default)]
pub struct GraphViewState {
pub layout_state: LayoutState,

pub show_debug: bool,

pub visual_bounds: Option<VisualBounds2D>,
pub rect_in_ui: Option<Rect>,
}
Expand All @@ -35,12 +32,6 @@ impl GraphViewState {
ui.end_row();
}

pub fn debug_ui(&mut self, ui: &mut egui::Ui) {
ui.re_checkbox(&mut self.show_debug, "Show debug information")
.on_hover_text("Shows debug information for the current graph");
ui.end_row();
}

pub fn simulation_ui(&mut self, ui: &mut egui::Ui) {
if ui.button("Reset simulation").clicked() {
self.layout_state.reset();
Expand Down
8 changes: 1 addition & 7 deletions crates/viewer/re_view_graph/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use re_viewport_blueprint::ViewProperty;
use crate::{
graph::Graph,
layout::{ForceLayoutParams, LayoutRequest},
ui::{draw_debug, draw_graph, view_property_force_ui, GraphViewState, LevelOfDetail},
ui::{draw_graph, view_property_force_ui, GraphViewState, LevelOfDetail},
visualizers::{merge, EdgesVisualizer, NodeVisualizer},
};

Expand Down Expand Up @@ -131,7 +131,6 @@ Display a graph of nodes and edges.
ui.selection_grid("graph_view_settings_ui").show(ui, |ui| {
state.layout_ui(ui);
state.simulation_ui(ui);
state.debug_ui(ui);
});

re_ui::list_item::list_item_scope(ui, "graph_selection_ui", |ui| {
Expand Down Expand Up @@ -199,11 +198,6 @@ Display a graph of nodes and edges.
let graph_rect = draw_graph(ui, ctx, graph, layout, query, level_of_detail);
world_bounding_rect = world_bounding_rect.union(graph_rect);
}

// We need to draw the debug information after the rest to ensure that we have the correct bounding box.
if state.show_debug {
draw_debug(ui, world_bounding_rect);
}
});

if resp.hovered() {
Expand Down

0 comments on commit 7781de0

Please sign in to comment.