From c0931d02fa3d6c920e7b02f422b7d3a7188e9cc6 Mon Sep 17 00:00:00 2001 From: "Pey Lian Lim (Github)" <2090236+pllim@users.noreply.github.com> Date: Wed, 22 Jun 2022 12:57:21 -0400 Subject: [PATCH] WIP: Investigation went nowhere. This needs clean-up for production. [ci skip] --- jdaviz/app.py | 1 + .../configs/imviz/plugins/rotate_image/rotate_image.py | 7 ++++--- jdaviz/configs/imviz/plugins/viewers.py | 9 +++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/jdaviz/app.py b/jdaviz/app.py index 4f7bc4dac9..5ef070d679 100644 --- a/jdaviz/app.py +++ b/jdaviz/app.py @@ -1087,6 +1087,7 @@ def resize(stack_items): # TODO: set appropriate viewer.zoom_level # TODO: box-zoom to act based on overscaled canvas # viewer = self._viewer_by_id(args[0]['viewer']) + # viewer.zoom_level = 'fit' # Did not see any difference, also tried 0.5 pass def vue_destroy_viewer_item(self, cid): diff --git a/jdaviz/configs/imviz/plugins/rotate_image/rotate_image.py b/jdaviz/configs/imviz/plugins/rotate_image/rotate_image.py index 6cf470259f..bd3ef358f8 100644 --- a/jdaviz/configs/imviz/plugins/rotate_image/rotate_image.py +++ b/jdaviz/configs/imviz/plugins/rotate_image/rotate_image.py @@ -22,9 +22,10 @@ def vue_rotate_image(self, *args, **kwargs): except Exception: return - # Rotate selected viewer canvas + viewer = self.app._viewer_by_id(self.viewer_selected) + + # Rotate selected viewer canvas. This changes zoom too. self.app._viewer_item_by_id(self.viewer_selected)['rotation'] = self._theta - # Update Compass - viewer = self.app._viewer_by_id(self.viewer_selected) + # Update Compass plugin. viewer.on_limits_change() diff --git a/jdaviz/configs/imviz/plugins/viewers.py b/jdaviz/configs/imviz/plugins/viewers.py index 3ddd4eb7ba..d5c5e9d24d 100644 --- a/jdaviz/configs/imviz/plugins/viewers.py +++ b/jdaviz/configs/imviz/plugins/viewers.py @@ -245,6 +245,15 @@ def _get_real_xy(self, image, x, y): return x, y, coords_status + # TODO: Remove if we end up not using it. + # def _get_zoom_center(self, image): + # """Return ``(x, y)`` of the center of zoom for a given image. + # Also see :meth:`_get_zoom_limits`. + # """ + # x_cen = (self.state.x_min + self.state.x_max) * 0.5 + # y_cen = (self.state.y_min + self.state.y_max) * 0.5 + # return self._get_real_xy(image, x_cen, y_cen)[:2] + def _get_zoom_limits(self, image): """Return a list of ``(x, y)`` that defines four corners of the zoom box for a given image.