def _subplot_scrolled(self, event):
keys = event['key']
if not keys:
# at least 1 step per event but a maximum of 5
step = max(1, abs(int(event['step'])))
step = min(step, 5)
step = copysign(step, event['step'])
slice_model = self._get_slice_view(event).model()
index = int(slice_model.index + step)
if 0 <= index < len(slice_model):
self._context.update_index_for_direction(slice_model.index_direction, index)
elif keys.state(ctrl=True) or keys.state(shift=True):
x = event['x']
y = event['y']
step = max(1, abs(int(event['step'])))
step = copysign(step / 20.0, event['step'])
slice_view = self._get_slice_view(event)
if slice_view.zoom(x, y, step):
self._context_changed()
评论列表
文章目录