Skip to content

Commit

Permalink
Move center_on_data event check to vue method
Browse files Browse the repository at this point in the history
  • Loading branch information
duytnguyendtn committed Oct 23, 2024
1 parent 920b4b8 commit 859379f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,18 @@ def vue_center_on_data(self, event=None):
if not self.viewer_selected or self.viewer_selected == "Manual":
return

# If the user panned but tracking not enabled, don't recenter
# NOTE: float event typecheck assumes the only "float" type event triggering this method
# is "zoom_center_x" and "zoom_center_y"
# Otherwise, need some other way to determine the event = user panning
if isinstance(event, float) and not self.coord_follow_viewer_pan:
# Thus, we're no longer centered
self.viewer_centered = False
return

self.center_on_data(event)

def center_on_data(self, event=None):
def center_on_data(self, _=None):
"""
If data is present in the default viewer, center the plugin's coordinates on
the viewer's center WCS coordinates.
Expand All @@ -164,14 +173,6 @@ def center_on_data(self, event=None):
# mixin object not yet initialized
return

# If the user panned but tracking not enabled, don't recenter
# NOTE: float event typecheck assumes the only "float" type event triggering this method
# is "zoom_center_x" and "zoom_center_y"
# Otherwise, need some other way to determine the event = user panning
if isinstance(event, float) and not self.coord_follow_viewer_pan:
# Thus, we're no longer centered
self.viewer_centered = False
return

# gets the current viewer
viewer = self.viewer.selected_obj
Expand Down

0 comments on commit 859379f

Please sign in to comment.