File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
Filter options
fastplotlib/graphics/selectors Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
Original file line number Diff line number Diff line change 1
1
from typing import *
2
2
from dataclasses import dataclass
3
3
from functools import partial
4
- import weakref
5
4
6
5
import numpy as np
7
6
@@ -269,30 +268,35 @@ def _move_to_pointer(self, ev):
269
268
"""
270
269
Calculates delta just using current world object position and calls self._move_graphic().
271
270
"""
272
- current_position : np .ndarray = self .offset
273
-
274
- # middle mouse button clicks
271
+ # check for middle mouse button click
275
272
if ev .button != 3 :
276
273
return
277
274
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
+
278
282
world_pos = self ._plot_area .map_screen_to_world (ev )
279
283
280
284
# outside this viewport
281
285
if world_pos is None :
282
286
return
283
287
284
- self .delta = world_pos - current_position
288
+ self .delta = world_pos - current_pos_world
285
289
self ._pygfx_event = ev
286
290
287
291
# use fill by default as the source, such as in region selectors
288
292
if len (self ._fill ) > 0 :
289
293
self ._move_info = MoveInfo (
290
- last_position = current_position , source = self ._fill [0 ]
294
+ last_position = current_pos_world , source = self ._fill [0 ]
291
295
)
292
296
# else use an edge, such as for linear selector
293
297
else :
294
298
self ._move_info = MoveInfo (
295
- last_position = current_position , source = self ._edges [0 ]
299
+ last_position = current_pos_world , source = self ._edges [0 ]
296
300
)
297
301
298
302
self ._move_graphic (self .delta )
You can’t perform that action at this time.
0 commit comments