lifegadget / ui-slider

A visually attractive slider for ambitious Ember apps
https://ui-slider.firebaseapp.com/
MIT License
30 stars 39 forks source link

Setting value can fail if min/max are not explicitly set #35

Open johnsogg opened 7 years ago

johnsogg commented 7 years ago

I set up the slider like this in the template:

          {{ui-slider
             value=(inch-to-slider-ticks offsetInches)
             action=(action 'spaceSlider')
             ticks='0, 128, 256, 384, 512, 640, 768, 896, 1024'
             ticksLabels='None, 1/8", 1/4", 3/8", 1/2", 5/8", 3/4", 7/8", 1"'
             tooltip='hide'
             step=64 }}

The user can type a value in to a textbox elsewhere, which causes the offsetInches binding to kick in, and the slider is handed a new value, e.g. 123. But immediately the slider would report an action that the value had changed to 10.

Looks like this also happens to be the default max value: https://github.com/lifegadget/ui-slider/blob/master/addon/components/ui-slider.js#L38

Discovered that if I explicitly set the min and max properties to 0 and 1024 respectively, the slider behaves as corrected.

Maybe the min and max props should float depending on ticks?