Skip to content

Commit

Permalink
Allow rolling 3D camera with primary mouse button + alt modifier (#1659)
Browse files Browse the repository at this point in the history
Fixes #1585
  • Loading branch information
Wumpf authored Mar 21, 2023
1 parent 0fcb0ad commit ca64913
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions crates/re_viewer/src/ui/view_spatial/eye.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,17 +266,20 @@ impl OrbitEye {
let mut did_interact = false;

if response.drag_delta().length() > drag_threshold {
if response.dragged_by(egui::PointerButton::Primary) {
if response.dragged_by(egui::PointerButton::Middle)
|| (response.dragged_by(egui::PointerButton::Primary)
&& response.ctx.input(|i| i.modifiers.alt))
{
if let Some(pointer_pos) = response.ctx.pointer_latest_pos() {
self.roll(&response.rect, pointer_pos, response.drag_delta());
did_interact = true;
}
} else if response.dragged_by(egui::PointerButton::Primary) {
self.rotate(response.drag_delta());
did_interact = true;
} else if response.dragged_by(egui::PointerButton::Secondary) {
self.translate(response.drag_delta());
did_interact = true;
} else if response.dragged_by(egui::PointerButton::Middle) {
if let Some(pointer_pos) = response.ctx.pointer_latest_pos() {
self.roll(&response.rect, pointer_pos, response.drag_delta());
did_interact = true;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/view_spatial/ui_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ fn find_camera(space_cameras: &[SpaceCamera3D], needle: &InstancePathHash) -> Op

pub const HELP_TEXT_3D: &str = "Drag to rotate.\n\
Drag with secondary mouse button to pan.\n\
Drag with middle mouse button to roll the view.\n\
Drag with middle mouse button (or primary mouse button + holding Alt/⌥ key) to roll the view.\n\
Scroll to zoom.\n\
\n\
While hovering the 3D view, navigate with WSAD and QE.\n\
Expand Down

1 comment on commit ca64913

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust Benchmark

Benchmark suite Current: ca64913 Previous: 0fcb0ad Ratio
datastore/insert/batch/rects/insert 552235 ns/iter (± 2634) 557205 ns/iter (± 1882) 0.99
datastore/latest_at/batch/rects/query 1843 ns/iter (± 5) 1836 ns/iter (± 11) 1.00
datastore/latest_at/missing_components/primary 286 ns/iter (± 1) 287 ns/iter (± 0) 1.00
datastore/latest_at/missing_components/secondaries 437 ns/iter (± 2) 439 ns/iter (± 1) 1.00
datastore/range/batch/rects/query 150686 ns/iter (± 553) 152637 ns/iter (± 871) 0.99
mono_points_arrow/generate_message_bundles 49846601 ns/iter (± 2176756) 44117864 ns/iter (± 1648074) 1.13
mono_points_arrow/generate_messages 138417161 ns/iter (± 1570325) 136139983 ns/iter (± 1465947) 1.02
mono_points_arrow/encode_log_msg 167342513 ns/iter (± 943493) 163101332 ns/iter (± 1854183) 1.03
mono_points_arrow/encode_total 353014665 ns/iter (± 2791879) 352907264 ns/iter (± 2178384) 1.00
mono_points_arrow/decode_log_msg 185829826 ns/iter (± 1769237) 183797873 ns/iter (± 1268945) 1.01
mono_points_arrow/decode_message_bundles 74927892 ns/iter (± 4142125) 70564940 ns/iter (± 1602444) 1.06
mono_points_arrow/decode_total 260355330 ns/iter (± 2222384) 253713270 ns/iter (± 2231095) 1.03
batch_points_arrow/generate_message_bundles 327974 ns/iter (± 1125) 327424 ns/iter (± 336) 1.00
batch_points_arrow/generate_messages 6493 ns/iter (± 32) 6509 ns/iter (± 23) 1.00
batch_points_arrow/encode_log_msg 353040 ns/iter (± 2334) 349970 ns/iter (± 898) 1.01
batch_points_arrow/encode_total 706716 ns/iter (± 2769) 699347 ns/iter (± 2274) 1.01
batch_points_arrow/decode_log_msg 346757 ns/iter (± 696) 347986 ns/iter (± 541) 1.00
batch_points_arrow/decode_message_bundles 2033 ns/iter (± 7) 2099 ns/iter (± 8) 0.97
batch_points_arrow/decode_total 352877 ns/iter (± 984) 353559 ns/iter (± 503) 1.00
arrow_mono_points/insert 6965384294 ns/iter (± 20030219) 7086845384 ns/iter (± 54961977) 0.98
arrow_mono_points/query 1754354 ns/iter (± 10591) 1823528 ns/iter (± 38013) 0.96
arrow_batch_points/insert 2620207 ns/iter (± 12508) 2677302 ns/iter (± 93277) 0.98
arrow_batch_points/query 16123 ns/iter (± 84) 16128 ns/iter (± 20) 1.00
arrow_batch_vecs/insert 41498 ns/iter (± 179) 42770 ns/iter (± 181) 0.97
arrow_batch_vecs/query 388676 ns/iter (± 621) 389621 ns/iter (± 640) 1.00
tuid/Tuid::random 34 ns/iter (± 0) 34 ns/iter (± 0) 1

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.