diff --git a/jdaviz/configs/imviz/plugins/tools.py b/jdaviz/configs/imviz/plugins/tools.py index 3ae81d4890..4f242585cb 100644 --- a/jdaviz/configs/imviz/plugins/tools.py +++ b/jdaviz/configs/imviz/plugins/tools.py @@ -16,9 +16,13 @@ class _ImvizMatchedZoomMixin(_MatchedZoomMixin): - match_keys = ('x_min', 'x_max', 'y_min', 'y_max') + match_axes = [] disable_matched_zoom_in_other_viewer = True + @property + def match_keys(self): + return ('zoom_center_x', 'zoom_center_y', 'zoom_radius') + def _is_matched_viewer(self, viewer): return isinstance(viewer, BqplotImageView) diff --git a/jdaviz/core/tools.py b/jdaviz/core/tools.py index df7e63494f..fa901cc684 100644 --- a/jdaviz/core/tools.py +++ b/jdaviz/core/tools.py @@ -115,7 +115,7 @@ def on_limits_change(self, *args): viewer.zoom_level = old_level * float(to_fov_sky / orig_fov_sky) viewer.center_on(sky_cen) - else: + elif len(self.match_axes): with delay_callback(viewer.state, *self.match_keys): for ax in self.match_axes: if None in orig_lims.values(): @@ -134,6 +134,13 @@ def on_limits_change(self, *args): if not np.isnan(value) and (orig_value is None or abs(value-orig_lims.get(k, np.inf)) > tol): setattr(viewer.state, k, value) + else: + # match keys, but not match axes (e.g., zoom_center and zoom_radius) + with delay_callback(viewer.state, *self.match_keys): + for k in self.match_keys: + value = to_lims.get(k) + if not np.isnan(value): + setattr(viewer.state, k, value) def is_visible(self): return len(self.viewer.jdaviz_app._viewer_store) > 1