Browse Source

don't unselect scene item when click order or menu

Bastien Sevajol 3 years ago
parent
commit
0d4fcc15f4
1 changed files with 12 additions and 1 deletions
  1. 12 1
      src/scene/main.rs

+ 12 - 1
src/scene/main.rs View File

161
     fn digest_click(&mut self, window_click_point: WindowPoint) {
161
     fn digest_click(&mut self, window_click_point: WindowPoint) {
162
         let scene_click_point =
162
         let scene_click_point =
163
             scene_point_from_window_point(&window_click_point, &self.display_offset);
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
         if let Some(scene_item_usize) =
168
         if let Some(scene_item_usize) =
166
             self.get_first_scene_item_for_scene_point(&scene_click_point)
169
             self.get_first_scene_item_for_scene_point(&scene_click_point)
167
         {
170
         {
171
+            self.selected_scene_items.drain(..);
168
             self.selected_scene_items.push(scene_item_usize);
172
             self.selected_scene_items.push(scene_item_usize);
173
+            scene_item_selected = true;
169
         }
174
         }
170
 
175
 
171
         if let Some(scene_item_prepare_order) = &self.scene_item_prepare_order {
176
         if let Some(scene_item_prepare_order) = &self.scene_item_prepare_order {
178
             }
183
             }
179
 
184
 
180
             self.scene_item_prepare_order = None;
185
             self.scene_item_prepare_order = None;
186
+            prepare_order_clicked = true;
181
         }
187
         }
182
 
188
 
183
         if let Some((scene_item_usize, scene_menu_point)) = self.scene_item_menu {
189
         if let Some((scene_item_usize, scene_menu_point)) = self.scene_item_menu {
196
                 }
202
                 }
197
             };
203
             };
198
             self.scene_item_menu = None;
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
     fn digest_right_click(&mut self, window_right_click_point: WindowPoint) {
213
     fn digest_right_click(&mut self, window_right_click_point: WindowPoint) {