Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c30bc64

Browse filesBrowse files
kushalkolarclewis7
andauthored
fix BaseSelector._move_to_pointer (#592)
* fix BaseSelector._move_to_pointer * fix pygfx intersphinx link --------- Co-authored-by: Caitlin <caitlin9165@gmail.com>
1 parent c7d7ff5 commit c30bc64
Copy full SHA for c30bc64

File tree

Expand file treeCollapse file tree

1 file changed

+11
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-7
lines changed

‎fastplotlib/graphics/selectors/_base_selector.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/selectors/_base_selector.py
+11-7Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from typing import *
22
from dataclasses import dataclass
33
from functools import partial
4-
import weakref
54

65
import numpy as np
76

@@ -269,30 +268,35 @@ def _move_to_pointer(self, ev):
269268
"""
270269
Calculates delta just using current world object position and calls self._move_graphic().
271270
"""
272-
current_position: np.ndarray = self.offset
273-
274-
# middle mouse button clicks
271+
# check for middle mouse button click
275272
if ev.button != 3:
276273
return
277274

275+
if self.axis == "x":
276+
offset = self.offset[0]
277+
elif self.axis == "y":
278+
offset = self.offset[1]
279+
280+
current_pos_world: np.ndarray = self.selection + offset
281+
278282
world_pos = self._plot_area.map_screen_to_world(ev)
279283

280284
# outside this viewport
281285
if world_pos is None:
282286
return
283287

284-
self.delta = world_pos - current_position
288+
self.delta = world_pos - current_pos_world
285289
self._pygfx_event = ev
286290

287291
# use fill by default as the source, such as in region selectors
288292
if len(self._fill) > 0:
289293
self._move_info = MoveInfo(
290-
last_position=current_position, source=self._fill[0]
294+
last_position=current_pos_world, source=self._fill[0]
291295
)
292296
# else use an edge, such as for linear selector
293297
else:
294298
self._move_info = MoveInfo(
295-
last_position=current_position, source=self._edges[0]
299+
last_position=current_pos_world, source=self._edges[0]
296300
)
297301

298302
self._move_graphic(self.delta)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.