remove notion indicator if motion interrupted at edge
This commit is contained in:
parent
592cd7fedf
commit
51b08d865d
|
@ -34,7 +34,7 @@ class ENV(NonWidget):
|
|||
'_stop','_tasklock','_containerlock','_hci','_listener','_window',
|
||||
'_inrequire','_inrequirelock','_inrequirerun','_tasks',
|
||||
'_canvases','_thumbnails','_containers','_actions',
|
||||
'_anti_alias','_scale_ratio','_use_page','_canvas_offset',
|
||||
'_anti_alias','_scale_ratio','_use_page','_canvas_offset','_canvas_offset_old',
|
||||
'_thumbsize','_maxthumbsize','_thumbgap','_checker','_fgcolor','_cachesize',
|
||||
'_viewmode','_tiling_width','_double_canvas','_double_right',
|
||||
'_statusbar_size','_statusbar_pos','_orientation','_blklmt',
|
||||
|
@ -79,6 +79,8 @@ class ENV(NonWidget):
|
|||
self._use_page=config.user_interface.usepage
|
||||
# offset of canvas to center
|
||||
self._canvas_offset=(0,0)
|
||||
# previous value of canvas offset
|
||||
self._canvas_offset_old=(0,0)
|
||||
# size of thumbnail in tiling view
|
||||
self._thumbsize=config.thumbnail.size
|
||||
# max size of thumbnail in tiling view
|
||||
|
@ -233,16 +235,21 @@ class ENV(NonWidget):
|
|||
assert is_mainthread()
|
||||
x,y=value
|
||||
if self._canvas_offset==(x,y):return
|
||||
self._canvas_offset_old=self._canvas_offset
|
||||
self._canvas_offset=x,y
|
||||
self.runactions()
|
||||
|
||||
@property
|
||||
def canvas_offset_old(self):
|
||||
assert is_mainthread()
|
||||
return self._canvas_offset_old
|
||||
|
||||
def canvas_move(self,x,y):
|
||||
assert is_mainthread()
|
||||
self.motion_status=x,y
|
||||
if not (x or y):return False
|
||||
oldx,oldy=self.canvas_offset
|
||||
self.canvas_offset=(oldx+x,oldy+y)
|
||||
return self.canvas_offset!=(oldx,oldy)
|
||||
self.canvas_offset=map(sum,zip(self.canvas_offset,(x,y)))
|
||||
return self.canvas_offset!=self.canvas_offset_old
|
||||
|
||||
@property
|
||||
def thumbsize(self):
|
||||
|
@ -358,7 +365,9 @@ class ENV(NonWidget):
|
|||
@property
|
||||
def motion_status(self):
|
||||
assert is_mainthread()
|
||||
return None if self._motion_id is None else self._motion_status
|
||||
if self._motion_id is None:return None
|
||||
if not any(self._motion_status):return None
|
||||
return self._motion_status
|
||||
|
||||
@motion_status.setter
|
||||
def motion_status(self,value):
|
||||
|
@ -416,7 +425,9 @@ class ENV(NonWidget):
|
|||
|
||||
def action_motion_stop(self):
|
||||
assert is_mainthread()
|
||||
if self._motion_id is None:return
|
||||
self._motion_id=None
|
||||
self.runactions()
|
||||
|
||||
def match_event(self,event):
|
||||
# match and process event in mainthread, return True to breakout looper
|
||||
|
@ -519,7 +530,6 @@ class ENV(NonWidget):
|
|||
case SDLE_EvEmu.SDL_SDLUI_MOTIONCONTINUE:
|
||||
x,y,motion_id=args
|
||||
if motion_id!=self._motion_id:
|
||||
self.runactions()
|
||||
assert verb(__name__,f'{self}: motion stop')
|
||||
return
|
||||
if not self.canvas_move(x,y):
|
||||
|
|
|
@ -627,6 +627,7 @@ def create_blocks(position,length,limit=5,color=(0xff,0xff,0xff)):
|
|||
|
||||
def draw_motion_indicator(self):
|
||||
# draw motion indicator
|
||||
if self.canvas_offset==self.canvas_offset_old:return
|
||||
if self.motion_status is None:return
|
||||
area_x,area_y,area_w,area_h=self.get_renderer_area_for_canvas()
|
||||
xstat,ystat=self.motion_status
|
||||
|
|
Loading…
Reference in New Issue