Skip to content

Commit

Permalink
Set slider to min/max constraint when value exceeds constraint.
Browse files Browse the repository at this point in the history
Currently, when a slider's limits are constrained by another slider (using `slidermin/slidermax`), the slider will simply return unchanged when you move the slider beyond the limits.

Instead, the slider should update to the min/max value when `closedmin/closedmax` attributes are True. This would match the behavior of the `valmin/valmax` limits.
  • Loading branch information
tonysyu committed Mar 16, 2012
1 parent 46581d9 commit b61507b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/matplotlib/widgets.py
Expand Up @@ -307,11 +307,15 @@ def _update(self, event):
return
val = self.valmax

if self.slidermin is not None:
if val<=self.slidermin.val: return
if self.slidermin is not None and val <= self.slidermin.val:
if not self.closedmin:
return
val = self.slidermin.val

if self.slidermax is not None:
if val>=self.slidermax.val: return
if self.slidermax is not None and val >= self.slidermax.val:
if not self.closedmax:
return
val = self.slidermax.val

self.set_val(val)

Expand Down

0 comments on commit b61507b

Please sign in to comment.