@@ -136,8 +136,13 @@ def __init__(
136
136
137
137
self ._hover_responsive : Tuple [WorldObject , ...] = hover_responsive
138
138
139
+ # Original color of object that we change the colors of
140
+ self ._original_colors = {}
141
+
142
+ # Colors as they are changed by the hover events, so they can be restored after a move action
143
+ self ._hover_colors = {}
144
+
139
145
if hover_responsive is not None :
140
- self ._original_colors = dict ()
141
146
for wo in self ._hover_responsive :
142
147
self ._original_colors [wo ] = wo .material .color
143
148
@@ -325,6 +330,11 @@ def _move_end(self, ev):
325
330
self ._move_info = None
326
331
self ._moving = False
327
332
333
+ # Reset hover state
334
+ for wo , color in self ._hover_colors .items ():
335
+ wo .material .color = color
336
+ self ._hover_colors .clear ()
337
+
328
338
# restore the initial controller state
329
339
# if it was disabled, keep it disabled
330
340
if self ._initial_controller_state is not None :
@@ -378,6 +388,7 @@ def _move_to_pointer(self, ev):
378
388
self ._move_info = None
379
389
380
390
def _pointer_enter (self , ev ):
391
+
381
392
if self ._hover_responsive is None :
382
393
return
383
394
@@ -388,17 +399,23 @@ def _pointer_enter(self, ev):
388
399
if wo in self ._edges :
389
400
self ._edge_hovered = True
390
401
391
- wo .material .color = "magenta"
402
+ if self ._moving :
403
+ self ._hover_colors [wo ] = "magenta"
404
+ else :
405
+ wo .material .color = "magenta"
392
406
393
407
def _pointer_leave (self , ev ):
394
408
if self ._hover_responsive is None :
395
409
return
396
410
411
+ self ._edge_hovered = False
412
+
397
413
# reset colors
398
414
for wo in self ._hover_responsive :
399
- wo .material .color = self ._original_colors [wo ]
400
-
401
- self ._edge_hovered = False
415
+ if self ._moving :
416
+ self ._hover_colors [wo ] = self ._original_colors [wo ]
417
+ else :
418
+ wo .material .color = self ._original_colors [wo ]
402
419
403
420
def _toggle_arrow_key_moveable (self , ev ):
404
421
self .arrow_key_events_enabled = not self .arrow_key_events_enabled
0 commit comments