Skip to content

Commit 31c314c

Browse files
author
Pietro Vertechi
authored
Merge pull request #148 from piever/pv/slider
fix both sliders
2 parents 0c846c6 + 0e0299a commit 31c314c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/slider.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function slider(::WidgetTheme, vals::AbstractUnitRange{<:Integer}, formatted_val
5252
(value isa AbstractObservable) || (value = convert(eltype(vals), value))
5353
format = js"""
5454
function(){
55-
return this.formatted_vals()[parseInt(this.index())-$min];
55+
return this.formatted_vals()[parseInt(this.index())-($min)];
5656
}
5757
"""
5858
ui = input(value; bindto="index", attributes=attributes, extra_obs = ["formatted_vals" => formatted_vals], computed = ["formatted_val" => format],
@@ -123,17 +123,17 @@ function rangeslider(theme::WidgetTheme, vals::AbstractUnitRange{<:Integer}, for
123123
connect: $connect,
124124
orientation: $orientation,
125125
format: {
126-
to: function ( value ) {
127-
var ind = Math.round(value-$min);
128-
return ind + 1 > vals.length ? vals[vals.length - 1] : vals[ind];
129-
},
130-
from: function ( value ) {
131-
return value;
132-
}
126+
to: function ( value ) {
127+
var ind = Math.round(value-($min));
128+
return ind + 1 > vals.length ? vals[vals.length - 1] : vals[ind];
129+
},
130+
from: function ( value ) {
131+
return parseInt(value);
132+
}
133133
},
134134
range: {
135-
'min': $min,
136-
'max': $max
135+
'min': ($min),
136+
'max': ($max)
137137
},})
138138
139139
slider.noUiSlider.on("slide", updateValue);

0 commit comments

Comments
 (0)