Skip to content

Commit

Permalink
Try to handle edge responses (not working)
Browse files Browse the repository at this point in the history
  • Loading branch information
grtlr committed Nov 27, 2024
1 parent 8d9e1fb commit 3034d55
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions crates/viewer/re_space_view_graph/src/canvas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ fn draw_arrow(painter: &Painter, tip: Pos2, direction: Vec2, color: Color32) {
));
}

pub fn draw_edge(ui: &mut Ui, points: [Pos2; 2], show_arrow: bool) -> Response {
pub fn draw_edge(ui: &mut Ui, world_to_view: &mut TSTransform, points: [Pos2; 2], show_arrow: bool) -> Response {
let fg = ui.style().visuals.text_color();

let painter = ui.painter();
Expand All @@ -116,7 +116,8 @@ pub fn draw_edge(ui: &mut Ui, points: [Pos2; 2], show_arrow: bool) -> Response {
draw_arrow(painter, points[1], direction, fg);
}

ui.allocate_rect(Rect::from_points(&points), Sense::hover())
let resp = ui.allocate_rect(Rect::from_points(&points), Sense::hover());
register_pan_and_zoom(ui, resp, world_to_view)
}

pub fn zoom_pan_area(
Expand Down
1 change: 1 addition & 0 deletions crates/viewer/re_space_view_graph/src/layout/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub struct Layout {
}

impl Layout {
#[deprecated]
pub fn bounding_rect(&self) -> Rect {
// TODO(grtlr): We mostly use this for debugging, but we should probably
// take all elements of the layout into account.
Expand Down
3 changes: 2 additions & 1 deletion crates/viewer/re_space_view_graph/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ Display a graph of nodes and edges.

for edge in graph.edges() {
let points = layout.get_edge(edge.from, edge.to);
let resp = draw_edge(ui, points, edge.arrow);
let resp = draw_edge(ui, world_to_view, points, edge.arrow);
world_bounding_rect = world_bounding_rect.union(resp.rect);
}
}

Expand Down

0 comments on commit 3034d55

Please sign in to comment.