MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _onmove

Method _onmove

lib/matplotlib/widgets.py:2981–3022  ·  view source on GitHub ↗

Motion notify event handler.

(self, event)

Source from the content-addressed store, hash-verified

2979 self._set_span_cursor(enabled=e_dist <= self.grab_range)
2980
2981 def _onmove(self, event):
2982 """Motion notify event handler."""
2983
2984 if self.direction == 'horizontal':
2985 v = event.xdata
2986 vpress = self._eventpress.xdata
2987 else:
2988 v = event.ydata
2989 vpress = self._eventpress.ydata
2990
2991 # move existing span
2992 # When "dragging from anywhere", `self._active_handle` is set to 'C'
2993 # (match notation used in the RectangleSelector)
2994 if self._active_handle == 'C' and self._extents_on_press is not None:
2995 vmin, vmax = self._extents_on_press
2996 dv = v - vpress
2997 vmin += dv
2998 vmax += dv
2999
3000 # resize an existing shape
3001 elif self._active_handle and self._active_handle != 'C':
3002 vmin, vmax = self._extents_on_press
3003 if self._active_handle == 'min':
3004 vmin = v
3005 else:
3006 vmax = v
3007 # new shape
3008 else:
3009 # Don't create a new span if there is already one when
3010 # ignore_event_outside=True
3011 if self.ignore_event_outside and self._selection_completed:
3012 return
3013 vmin, vmax = vpress, v
3014 if vmin > vmax:
3015 vmin, vmax = vmax, vmin
3016
3017 self._set_extents((vmin, vmax))
3018
3019 if self.onmove_callback is not None:
3020 self.onmove_callback(vmin, vmax)
3021
3022 return False
3023
3024 def _draw_shape(self, vmin, vmax):
3025 if vmin > vmax:

Callers

nothing calls this directly

Calls 1

_set_extentsMethod · 0.95

Tested by

no test coverage detected