mirror of https://github.com/encounter/objdiff.git
Avoid resetting diff state on unit config reload
This commit is contained in:
parent
cbe299e859
commit
575900024d
|
@ -267,15 +267,25 @@ impl AppState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_selected_obj(&mut self, config: ObjectConfig) {
|
pub fn set_selected_obj(&mut self, config: ObjectConfig) {
|
||||||
if self.config.selected_obj.as_ref().is_some_and(|existing| existing == &config) {
|
let mut unit_changed = true;
|
||||||
// Don't reload the object if there were no changes
|
if let Some(existing) = self.config.selected_obj.as_ref() {
|
||||||
return;
|
if existing == &config {
|
||||||
|
// Don't reload the object if there were no changes
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if existing.name == config.name {
|
||||||
|
unit_changed = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.config.selected_obj = Some(config);
|
self.config.selected_obj = Some(config);
|
||||||
self.obj_change = true;
|
if unit_changed {
|
||||||
self.queue_build = false;
|
self.obj_change = true;
|
||||||
self.selecting_left = None;
|
self.queue_build = false;
|
||||||
self.selecting_right = None;
|
self.selecting_left = None;
|
||||||
|
self.selecting_right = None;
|
||||||
|
} else {
|
||||||
|
self.queue_build = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_selected_obj(&mut self) {
|
pub fn clear_selected_obj(&mut self) {
|
||||||
|
|
Loading…
Reference in New Issue