Skip to content

Commit

Permalink
fix: -1 to make sure end_point is at end
Browse files Browse the repository at this point in the history
  • Loading branch information
Lundez committed Aug 1, 2023
1 parent 3dbef1b commit cfc826b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions solara/components/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def set_value_cast(value):
reactive_value.value = int(value)

if tick_labels == "end_points":
num_repeats = int(np.ceil((max - min) / step)) - 2
num_repeats = int(np.ceil((max - min) / step)) - 1
tick_labels = [str(min), *([None] * num_repeats), str(max)]

return rv.Slider(
Expand Down Expand Up @@ -133,7 +133,7 @@ def set_value_cast(value):
reactive_value.set((int(v1), int(v2)))

if tick_labels == "end_points":
num_repeats = int(np.ceil((max - min) / step)) - 2
num_repeats = int(np.ceil((max - min) / step)) - 1
tick_labels = [str(min), *([None] * num_repeats), str(max)]

return cast(
Expand Down Expand Up @@ -203,7 +203,7 @@ def set_value_cast(value):
reactive_value.set(float(value))

if tick_labels == "end_points":
num_repeats = int(np.ceil((max - min) / step)) - 2
num_repeats = int(np.ceil((max - min) / step)) - 1
tick_labels = [str(min), *([None] * num_repeats), str(max)]

return rv.Slider(
Expand Down Expand Up @@ -271,7 +271,7 @@ def set_value_cast(value):
reactive_value.set((float(v1), float(v2)))

if tick_labels == "end_points":
num_repeats = int(np.ceil((max - min) / step)) - 2
num_repeats = int(np.ceil((max - min) / step)) - 1
tick_labels = [str(min), *([None] * num_repeats), str(max)]

return cast(
Expand Down

0 comments on commit cfc826b

Please sign in to comment.