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

Track changed state in nav mode combo box #1703

Merged
merged 2 commits into from
Mar 27, 2023
Merged
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
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 @@ -315,24 +315,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