mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-29 12:43:38 +03:00
reset selection state after hiding something
This commit is contained in:
parent
cacf3aea62
commit
d66d070dd6
@ -248,7 +248,7 @@ impl Hider {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn event(&mut self, input: &mut UserInput, state: &SelectionState) {
|
||||
pub fn event(&mut self, input: &mut UserInput, state: &mut SelectionState) {
|
||||
if input.unimportant_key_pressed(Key::K, "Press k to unhide everything") {
|
||||
println!("Unhiding {} things", self.items.len());
|
||||
self.items.clear();
|
||||
@ -264,6 +264,7 @@ impl Hider {
|
||||
if input.unimportant_key_pressed(Key::H, &format!("Press h to hide {:?}", id)) {
|
||||
self.items.insert(id);
|
||||
println!("Hiding {:?}", id);
|
||||
*state = SelectionState::Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ impl gui::GUI for UI {
|
||||
let item = self.mouseover_something(window_size);
|
||||
self.current_selection_state = self.current_selection_state.handle_mouseover(item);
|
||||
}
|
||||
self.hider.event(input, &self.current_selection_state);
|
||||
self.hider.event(input, &mut self.current_selection_state);
|
||||
// TODO can't get this destructuring expressed right
|
||||
let (new_selection_state, new_event_loop_mode) =
|
||||
self.current_selection_state
|
||||
|
Loading…
Reference in New Issue
Block a user