Skip to content

Commit

Permalink
Track changed state in nav mode combo box (#1703)
Browse files Browse the repository at this point in the history
* Track changed state in nav mode combo box

* Simplify the code a bit

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
  • Loading branch information
jleibs and emilk authored Mar 27, 2023
1 parent 0749d34 commit 1cd2bb5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions crates/re_viewer/src/ui/view_spatial/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,24 +276,26 @@ impl ViewSpatialState {
.on_hover_text("The virtual camera which controls what is shown on screen.");
ui.vertical(|ui| {
let mut nav_mode = *self.nav_mode.get();
let nav_mode_response = egui::ComboBox::from_id_source("nav_mode")
let mut changed = false;
egui::ComboBox::from_id_source("nav_mode")
.selected_text(nav_mode)
.show_ui(ui, |ui| {
ui.style_mut().wrap = Some(false);
ui.set_min_width(64.0);

ui.selectable_value(
changed |= ui.selectable_value(
&mut nav_mode,
SpatialNavigationMode::TwoD,
SpatialNavigationMode::TwoD,
);
ui.selectable_value(
).changed();

changed |= ui.selectable_value(
&mut nav_mode,
SpatialNavigationMode::ThreeD,
SpatialNavigationMode::ThreeD,
);
}).response;
if nav_mode_response.changed() {
).changed();
});
if changed {
self.nav_mode = EditableAutoValue::UserEdited(nav_mode);
}

Expand Down

1 comment on commit 1cd2bb5

@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: 1cd2bb5 Previous: 0749d34 Ratio
datastore/insert/batch/rects/insert 547858 ns/iter (± 2567) 564652 ns/iter (± 2634) 0.97
datastore/latest_at/batch/rects/query 1837 ns/iter (± 63) 1894 ns/iter (± 15) 0.97
datastore/latest_at/missing_components/primary 286 ns/iter (± 2) 286 ns/iter (± 0) 1
datastore/latest_at/missing_components/secondaries 436 ns/iter (± 4) 438 ns/iter (± 0) 1.00
datastore/range/batch/rects/query 149977 ns/iter (± 1640) 150500 ns/iter (± 755) 1.00
mono_points_arrow/generate_message_bundles 44892991 ns/iter (± 1287024) 47989612 ns/iter (± 442261) 0.94
mono_points_arrow/generate_messages 123888941 ns/iter (± 1228014) 124779648 ns/iter (± 958301) 0.99
mono_points_arrow/encode_log_msg 155425399 ns/iter (± 919285) 159188318 ns/iter (± 1170373) 0.98
mono_points_arrow/encode_total 326384994 ns/iter (± 2070978) 331212498 ns/iter (± 2380425) 0.99
mono_points_arrow/decode_log_msg 173943214 ns/iter (± 1431381) 176499247 ns/iter (± 841555) 0.99
mono_points_arrow/decode_message_bundles 62214762 ns/iter (± 869818) 64400766 ns/iter (± 804128) 0.97
mono_points_arrow/decode_total 236709065 ns/iter (± 1901027) 237855916 ns/iter (± 1433300) 1.00
batch_points_arrow/generate_message_bundles 338605 ns/iter (± 3591) 340964 ns/iter (± 517) 0.99
batch_points_arrow/generate_messages 6239 ns/iter (± 55) 6313 ns/iter (± 18) 0.99
batch_points_arrow/encode_log_msg 368388 ns/iter (± 2211) 370683 ns/iter (± 6491) 0.99
batch_points_arrow/encode_total 727145 ns/iter (± 4398) 735922 ns/iter (± 3175) 0.99
batch_points_arrow/decode_log_msg 345949 ns/iter (± 1799) 349813 ns/iter (± 1470) 0.99
batch_points_arrow/decode_message_bundles 2007 ns/iter (± 13) 2043 ns/iter (± 7) 0.98
batch_points_arrow/decode_total 354295 ns/iter (± 1875) 355036 ns/iter (± 1890) 1.00
arrow_mono_points/insert 6038756633 ns/iter (± 15898319) 6178026404 ns/iter (± 19143005) 0.98
arrow_mono_points/query 1769635 ns/iter (± 18790) 1813840 ns/iter (± 28780) 0.98
arrow_batch_points/insert 2693496 ns/iter (± 12107) 2708501 ns/iter (± 20812) 0.99
arrow_batch_points/query 15981 ns/iter (± 130) 16170 ns/iter (± 652) 0.99
arrow_batch_vecs/insert 42337 ns/iter (± 313) 42638 ns/iter (± 261) 0.99
arrow_batch_vecs/query 385290 ns/iter (± 2919) 389167 ns/iter (± 1142) 0.99
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.