Skip to content

Commit

Permalink
fallbackView fix overlapping (#15)
Browse files Browse the repository at this point in the history
* Choose the min/max of the current value and the highest/lowest value +- a step.
  • Loading branch information
ccmdo authored May 3, 2019
1 parent 5cd720f commit 64dc9f1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/DoubleSlider.elm
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,18 @@ update message model =
newModel =
case valueType of
LowValue ->
{ model | lowValue = convertedValue }
let
newLowValue =
Basics.min convertedValue (model.highValue - (toFloat model.step * model.overlapThreshold))
in
{ model | lowValue = newLowValue }

HighValue ->
{ model | highValue = convertedValue }
let
newHighValue =
Basics.max convertedValue (model.lowValue + (toFloat model.step * model.overlapThreshold))
in
{ model | highValue = newHighValue }

None ->
model
Expand Down

0 comments on commit 64dc9f1

Please sign in to comment.