Parcourir la source

don't unselect scene item when click order or menu

Bastien Sevajol il y a 3 ans
Parent
révision
0d4fcc15f4
1 fichiers modifiés avec 12 ajouts et 1 suppressions
  1. 12 1
      src/scene/main.rs

+ 12 - 1
src/scene/main.rs Voir le fichier

@@ -161,11 +161,16 @@ impl MainState {
161 161
     fn digest_click(&mut self, window_click_point: WindowPoint) {
162 162
         let scene_click_point =
163 163
             scene_point_from_window_point(&window_click_point, &self.display_offset);
164
-        self.selected_scene_items.drain(..);
164
+        let mut scene_item_selected = false;
165
+        let mut scene_item_menu_clicked = false;
166
+        let mut prepare_order_clicked = false;
167
+
165 168
         if let Some(scene_item_usize) =
166 169
             self.get_first_scene_item_for_scene_point(&scene_click_point)
167 170
         {
171
+            self.selected_scene_items.drain(..);
168 172
             self.selected_scene_items.push(scene_item_usize);
173
+            scene_item_selected = true;
169 174
         }
170 175
 
171 176
         if let Some(scene_item_prepare_order) = &self.scene_item_prepare_order {
@@ -178,6 +183,7 @@ impl MainState {
178 183
             }
179 184
 
180 185
             self.scene_item_prepare_order = None;
186
+            prepare_order_clicked = true;
181 187
         }
182 188
 
183 189
         if let Some((scene_item_usize, scene_menu_point)) = self.scene_item_menu {
@@ -196,7 +202,12 @@ impl MainState {
196 202
                 }
197 203
             };
198 204
             self.scene_item_menu = None;
205
+            scene_item_menu_clicked = true;
199 206
         };
207
+
208
+        if !prepare_order_clicked && !scene_item_menu_clicked && !scene_item_selected {
209
+            self.selected_scene_items.drain(..);
210
+        }
200 211
     }
201 212
 
202 213
     fn digest_right_click(&mut self, window_right_click_point: WindowPoint) {