Skip to content

Commit 40338bd

Browse files
authored
Fix single-click and double-click in the graph view (#8474)
### Related <!-- Include links to any related issues/PRs in a bulleted list, for example: * Closes #1234 * Part of #1337 --> * Closes #8437 * Closes #8442 ### What This implements: * Single-click on empty space to select view. * Double-click on node to select entire entity. Merging @emilk's recent changes (#8469 and #8457) seems to have fixed the flickering on selection too.
1 parent a8ae6f5 commit 40338bd

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

crates/viewer/re_view_graph/src/ui/draw.rs

+15-5
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,6 @@ pub fn draw_graph(
362362

363363
let instance_path =
364364
InstancePath::instance(entity_path.clone(), instance.instance_index);
365-
ctx.handle_select_hover_drag_interactions(
366-
&response,
367-
Item::DataResult(query.view_id, instance_path.clone()),
368-
false,
369-
);
370365

371366
response = response.on_hover_ui_at_pointer(|ui| {
372367
list_item::list_item_scope(ui, "graph_node_hover", |ui| {
@@ -383,6 +378,21 @@ pub fn draw_graph(
383378
});
384379
});
385380

381+
ctx.handle_select_hover_drag_interactions(
382+
&response,
383+
Item::DataResult(query.view_id, instance_path.clone()),
384+
false,
385+
);
386+
387+
// double click selects the entire entity
388+
if response.double_clicked() {
389+
// Select the entire entity
390+
ctx.selection_state().set_selection(Item::DataResult(
391+
query.view_id,
392+
instance_path.entity_path.clone().into(),
393+
));
394+
}
395+
386396
response
387397
}
388398
Node::Implicit { graph_node, .. } => {

crates/viewer/re_view_graph/src/view.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use re_view::{
1919
view_property_ui,
2020
};
2121
use re_viewer_context::{
22-
IdentifiedViewSystem as _, RecommendedView, SystemExecutionOutput, ViewClass,
22+
IdentifiedViewSystem as _, Item, RecommendedView, SystemExecutionOutput, ViewClass,
2323
ViewClassLayoutPriority, ViewClassRegistryError, ViewId, ViewQuery, ViewSpawnHeuristics,
2424
ViewState, ViewStateExt as _, ViewSystemExecutionError, ViewSystemRegistrator, ViewerContext,
2525
};
@@ -206,6 +206,12 @@ Display a graph of nodes and edges.
206206
}
207207
});
208208

209+
if resp.clicked() {
210+
// clicked elsewhere, select the view
211+
ctx.selection_state()
212+
.set_selection(Item::View(query.view_id));
213+
}
214+
209215
// Update blueprint if changed
210216
let updated_rect_in_scene =
211217
blueprint::components::VisualBounds2D::from(ui_from_world.inverse() * rect_in_ui);

0 commit comments

Comments
 (0)