mirror of https://github.com/wayvr-org/wayvr.git
when exiting edit mode, pin watch before saving state
This commit is contained in:
parent
3c8f878ede
commit
da394ec2c7
|
|
@ -585,6 +585,19 @@ impl<T> OverlayWindowManager<T> {
|
||||||
pub fn set_edit_mode(&mut self, enabled: bool, app: &mut AppState) -> anyhow::Result<()> {
|
pub fn set_edit_mode(&mut self, enabled: bool, app: &mut AppState) -> anyhow::Result<()> {
|
||||||
let changed = enabled != self.edit_mode;
|
let changed = enabled != self.edit_mode;
|
||||||
self.edit_mode = enabled;
|
self.edit_mode = enabled;
|
||||||
|
|
||||||
|
if changed && let Some(watch) = self.mut_by_id(self.watch_id) {
|
||||||
|
watch
|
||||||
|
.config
|
||||||
|
.active_state
|
||||||
|
.iter_mut()
|
||||||
|
.for_each(|f| f.grabbable = enabled);
|
||||||
|
watch
|
||||||
|
.config
|
||||||
|
.backend
|
||||||
|
.notify(app, OverlayEventData::EditModeChanged(enabled))?;
|
||||||
|
}
|
||||||
|
|
||||||
if !enabled {
|
if !enabled {
|
||||||
for o in self.overlays.values_mut() {
|
for o in self.overlays.values_mut() {
|
||||||
self.wrappers.unwrap_edit_mode(&mut o.config, app)?;
|
self.wrappers.unwrap_edit_mode(&mut o.config, app)?;
|
||||||
|
|
@ -597,17 +610,6 @@ impl<T> OverlayWindowManager<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if changed && let Some(watch) = self.mut_by_id(self.watch_id) {
|
|
||||||
watch
|
|
||||||
.config
|
|
||||||
.active_state
|
|
||||||
.iter_mut()
|
|
||||||
.for_each(|f| f.grabbable = enabled);
|
|
||||||
watch
|
|
||||||
.config
|
|
||||||
.backend
|
|
||||||
.notify(app, OverlayEventData::EditModeChanged(enabled))?;
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue