mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
Fix validate logic if min/max are changed
This commit is contained in:
parent
1cb0cbf4b9
commit
b7bb76f073
@ -78,9 +78,11 @@ class _BoundedFloatRangeWidget(_FloatRangeWidget):
|
||||
"""Validate min <= low <= high <= max"""
|
||||
if name == "value":
|
||||
low, high = new
|
||||
low = max(low, self.min)
|
||||
high = min(high, self.max)
|
||||
self.value = (min(low, high), max(low, high))
|
||||
else:
|
||||
low, high = self.value
|
||||
low = max(low, self.min)
|
||||
high = min(high, self.max)
|
||||
self.value = (min(low, high), max(low, high))
|
||||
|
||||
|
||||
class FloatRangeSliderWidget(_BoundedFloatRangeWidget):
|
||||
|
@ -77,9 +77,11 @@ class _BoundedIntRangeWidget(_IntRangeWidget):
|
||||
"""Validate min <= low <= high <= max"""
|
||||
if name == "value":
|
||||
low, high = new
|
||||
low = max(low, self.min)
|
||||
high = min(high, self.max)
|
||||
self.value = (min(low, high), max(low, high))
|
||||
else:
|
||||
low, high = self.value
|
||||
low = max(low, self.min)
|
||||
high = min(high, self.max)
|
||||
self.value = (min(low, high), max(low, high))
|
||||
|
||||
|
||||
class IntRangeSliderWidget(_BoundedIntRangeWidget):
|
||||
|
Loading…
Reference in New Issue
Block a user