|
@@ -5,6 +5,8 @@ from math import floor
|
5
|
5
|
|
6
|
6
|
import pyglet
|
7
|
7
|
import time
|
|
8
|
+
|
|
9
|
+from cocos.collision_model import AARectShape
|
8
|
10
|
from pyglet.window import mouse
|
9
|
11
|
|
10
|
12
|
import cocos
|
|
@@ -235,7 +237,7 @@ class EditLayer(cocos.layer.Layer):
|
235
|
237
|
self.wdrag_start_point = (0, 0)
|
236
|
238
|
self.elastic_box = None # type: MinMaxRect
|
237
|
239
|
self.elastic_box_wminmax = 0, 0, 0, 0
|
238
|
|
- self.selection = {} # type: typing.List[Actor]
|
|
240
|
+ self.selection = {} # type: typing.Dict[Actor, AARectShape]
|
239
|
241
|
self.screen_mouse = (0, 0)
|
240
|
242
|
self.world_mouse = (0, 0)
|
241
|
243
|
self.sleft = None
|
|
@@ -615,7 +617,7 @@ class EditLayer(cocos.layer.Layer):
|
615
|
617
|
print("begin drag selection: drag_selecting, drag_moving",
|
616
|
618
|
self.drag_selecting, self.drag_moving)
|
617
|
619
|
|
618
|
|
- else:
|
|
620
|
+ elif self.can_move(under_mouse_unique):
|
619
|
621
|
# want drag move
|
620
|
622
|
if under_mouse_unique in self.selection:
|
621
|
623
|
# want to move current selection
|
|
@@ -625,6 +627,9 @@ class EditLayer(cocos.layer.Layer):
|
625
|
627
|
self.selection.clear()
|
626
|
628
|
self.selection_add(under_mouse_unique)
|
627
|
629
|
self.begin_drag_move()
|
|
630
|
+
|
|
631
|
+ def can_move(self, selected) -> bool:
|
|
632
|
+ return True
|
628
|
633
|
|
629
|
634
|
def begin_drag_move(self):
|
630
|
635
|
# begin drag move
|