Skip to content

Commit

Permalink
Merge pull request #345 from astrofrog/fix-limits-sync
Browse files Browse the repository at this point in the history
Don't set scale limits if glue state limits are None
  • Loading branch information
dhomeier authored Feb 7, 2023
2 parents 1d273cf + 9697545 commit edcb816
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions glue_jupyter/bqplot/common/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from ...view import IPyWidgetView
from ...link import on_change
from ...utils import float_or_none, debounced, get_ioloop
from ...utils import debounced, get_ioloop
from .tools import ROIClickAndDrag

__all__ = ['BqplotBaseView']
Expand Down Expand Up @@ -106,13 +106,15 @@ def _update_bqplot_limits(self, *args):
# doesn't change this - at the end of the day, the two scales are
# separate widgets so will result in two updates.

with self.scale_x.hold_sync():
self.scale_x.min = float_or_none(self.state.x_min)
self.scale_x.max = float_or_none(self.state.x_max)
if self.state.x_min is not None and self.state.x_max is not None:
with self.scale_x.hold_sync():
self.scale_x.min = float(self.state.x_min)
self.scale_x.max = float(self.state.x_max)

with self.scale_y.hold_sync():
self.scale_y.min = float_or_none(self.state.y_min)
self.scale_y.max = float_or_none(self.state.y_max)
if self.state.y_min is not None and self.state.y_max is not None:
with self.scale_y.hold_sync():
self.scale_y.min = float(self.state.y_min)
self.scale_y.max = float(self.state.y_max)

self._last_limits = (self.state.x_min, self.state.x_max,
self.state.y_min, self.state.y_max)
Expand Down

0 comments on commit edcb816

Please sign in to comment.