diff --git a/jdaviz/core/freezable_state.py b/jdaviz/core/freezable_state.py index 90b87c68fe..c79a4be37e 100644 --- a/jdaviz/core/freezable_state.py +++ b/jdaviz/core/freezable_state.py @@ -110,9 +110,17 @@ def _set_zoom_center(self, *args): self.x_max = self.x_min + width self.y_max = self.y_min + height + def _set_axes_aspect_ratio(self, axes_ratio): + # when aspect-ratio is changed (changing viewer.shape), ensure zoom/center are synced + # with zoom-limits + super()._set_axes_aspect_ratio(axes_ratio) + self._set_axes_lim() + def _set_axes_lim(self, *args): if self._during_zoom_sync or not hasattr(self, '_viewer') or self._viewer.shape is None: return + if None in (self.x_min, self.x_max, self.y_min, self.y_max): + return screenx = self._viewer.shape[1] screeny = self._viewer.shape[0]