File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ Template for new versions:
5959## New Features
6060
6161## Fixes
62+ - GUI: Fix sliders allowing values outside their number of stops (num_stops) when incremented with mouse clicks.
6263
6364## Misc Improvements
6465
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ function Slider:onInput(keys)
4141 local left_pos = width_per_idx * (left_idx - 1 )
4242 local right_pos = width_per_idx * (right_idx - 1 ) + 4
4343 if x < left_pos then
44- self .on_change (self .get_idx_fn () - 1 )
44+ self .on_change (math.max ( 1 , self .get_idx_fn () - 1 ) )
4545 elseif x < left_pos + 3 then
4646 self .is_dragging_target = ' left'
4747 self .is_dragging_idx = x - left_pos
@@ -52,7 +52,7 @@ function Slider:onInput(keys)
5252 self .is_dragging_target = ' right'
5353 self .is_dragging_idx = x - right_pos
5454 else
55- self .on_change (self .get_idx_fn () + 1 )
55+ self .on_change (math.min ( self .num_stops , self . get_idx_fn () + 1 ) )
5656 end
5757 return true
5858end
You can’t perform that action at this time.
0 commit comments