From 2e27a85ae7c4ab659c4c50bb5a2295897a792a7d Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Sat, 10 Aug 2024 19:18:06 -0400 Subject: [PATCH 1/2] fix BaseSelector._move_to_pointer --- .../graphics/selectors/_base_selector.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/fastplotlib/graphics/selectors/_base_selector.py b/fastplotlib/graphics/selectors/_base_selector.py index ab7bda049..fd6ed2f33 100644 --- a/fastplotlib/graphics/selectors/_base_selector.py +++ b/fastplotlib/graphics/selectors/_base_selector.py @@ -1,7 +1,6 @@ from typing import * from dataclasses import dataclass from functools import partial -import weakref import numpy as np @@ -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) From bc305d41504a0147103c58fc7ea7f66846836b9f Mon Sep 17 00:00:00 2001 From: Caitlin Date: Tue, 20 Aug 2024 19:06:11 -0400 Subject: [PATCH 2/2] fix pygfx intersphinx link --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 64c05b82c..1b296f533 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -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), }