Skip to content

Commit

Permalink
fix initializing zoom-level/center
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Jan 10, 2024
1 parent a0dea0b commit 121fc7a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions jdaviz/core/freezable_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 121fc7a

Please sign in to comment.