Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove debug information from graph view selection panel #8496

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading