@@ -136,8 +136,13 @@ def __init__(
136136
137137 self ._hover_responsive : Tuple [WorldObject , ...] = hover_responsive
138138
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+
139145 if hover_responsive is not None :
140- self ._original_colors = dict ()
141146 for wo in self ._hover_responsive :
142147 self ._original_colors [wo ] = wo .material .color
143148
@@ -325,6 +330,11 @@ def _move_end(self, ev):
325330 self ._move_info = None
326331 self ._moving = False
327332
333+ # Reset hover state
334+ for wo , color in self ._hover_colors .items ():
335+ wo .material .color = color
336+ self ._hover_colors .clear ()
337+
328338 # restore the initial controller state
329339 # if it was disabled, keep it disabled
330340 if self ._initial_controller_state is not None :
@@ -378,6 +388,7 @@ def _move_to_pointer(self, ev):
378388 self ._move_info = None
379389
380390 def _pointer_enter (self , ev ):
391+
381392 if self ._hover_responsive is None :
382393 return
383394
@@ -388,17 +399,23 @@ def _pointer_enter(self, ev):
388399 if wo in self ._edges :
389400 self ._edge_hovered = True
390401
391- wo .material .color = "magenta"
402+ if self ._moving :
403+ self ._hover_colors [wo ] = "magenta"
404+ else :
405+ wo .material .color = "magenta"
392406
393407 def _pointer_leave (self , ev ):
394408 if self ._hover_responsive is None :
395409 return
396410
411+ self ._edge_hovered = False
412+
397413 # reset colors
398414 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 ]
402419
403420 def _toggle_arrow_key_moveable (self , ev ):
404421 self .arrow_key_events_enabled = not self .arrow_key_events_enabled
0 commit comments