Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"pygfx": ("https://pygfx.org/stable", None),
"pygfx": ("https://docs.pygfx.org/stable/", None),
"wgpu": ("https://wgpu-py.readthedocs.io/en/latest", None),
"fastplotlib": ("https://fastplotlib.readthedocs.io/en/latest/", None),
}
Expand Down
18 changes: 11 additions & 7 deletions fastplotlib/graphics/selectors/_base_selector.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import *
from dataclasses import dataclass
from functools import partial
import weakref

import numpy as np

Expand Down Expand Up @@ -269,30 +268,35 @@ def _move_to_pointer(self, ev):
"""
Calculates delta just using current world object position and calls self._move_graphic().
"""
current_position: np.ndarray = self.offset

# middle mouse button clicks
# check for middle mouse button click
if ev.button != 3:
return

if self.axis == "x":
offset = self.offset[0]
elif self.axis == "y":
offset = self.offset[1]

current_pos_world: np.ndarray = self.selection + offset

world_pos = self._plot_area.map_screen_to_world(ev)

# outside this viewport
if world_pos is None:
return

self.delta = world_pos - current_position
self.delta = world_pos - current_pos_world
self._pygfx_event = ev

# use fill by default as the source, such as in region selectors
if len(self._fill) > 0:
self._move_info = MoveInfo(
last_position=current_position, source=self._fill[0]
last_position=current_pos_world, source=self._fill[0]
)
# else use an edge, such as for linear selector
else:
self._move_info = MoveInfo(
last_position=current_position, source=self._edges[0]
last_position=current_pos_world, source=self._edges[0]
)

self._move_graphic(self.delta)
Expand Down