GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix BaseSelector move_to_pointer · Issue #588 · fastplotlib/fastplotlib

fix BaseSelector move_to_pointer #588

New issue
Copy link
New issue
Copy link
Closed
#592
Closed
fix BaseSelector move_to_pointer#588
#592
Copy link

Description

@kushalkolar
kushalkolar
opened on Aug 8, 2024
Issue body actions

so this has been broken for a while, this should fix it, will PR later:

Subject: [PATCH] a
---
Index: fastplotlib/graphics/selectors/_base_selector.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fastplotlib/graphics/selectors/_base_selector.py b/fastplotlib/graphics/selectors/_base_selector.py
--- a/fastplotlib/graphics/selectors/_base_selector.py	(revision 84b23e8b03228b003212940205630cf7be75c5cb)
+++ b/fastplotlib/graphics/selectors/_base_selector.py	(date 1723148098223)
@@ -269,7 +269,12 @@
         """
         Calculates delta just using current world object position and calls self._move_graphic().
         """
-        current_position: np.ndarray = self.offset
+        if self.axis == "x":
+            offset = self.offset[0]
+        elif self.axis == "y":
+            offset = self.offset[1]
+
+        current_pos_world: np.ndarray = self.selection + offset
 
         # middle mouse button clicks
         if ev.button != 3:
@@ -281,18 +286,18 @@
         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)

Activity

  1. clewis7
    closed this as completedin #592on Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.