|
74 | 74 | ```
|
75 | 75 | function rangeslider(vals::AbstractArray;
|
76 | 76 | value=medianelement(vals),
|
77 |
| - label=nothing, readout=true, kwargs...) |
| 77 | + label=nothing, readout=true, |
| 78 | + orientation="horizontal", |
| 79 | + direction="ltr", kwargs...) |
78 | 80 | ```
|
79 | 81 |
|
80 | 82 | Creates a slider widget which can take on the values in `vals` and accepts several "handles".
|
81 | 83 | Pass a vector to `value` with two values if you want to select a range.
|
| 84 | +Use the `orientation="vertical"` keyword argument to create a vertical slider. |
| 85 | +By default the slider is top-to-botom and left-to-right, |
| 86 | +but this can be changed using the `direction="rtl"` keyword argument. |
82 | 87 | """
|
83 | 88 | function rangeslider(theme::WidgetTheme, vals::AbstractUnitRange{<:Integer}, formatted_vals = format.(vals);
|
84 | 89 | style = Dict(), label = nothing, value = medianelement(vals), orientation = "horizontal", readout = true,
|
85 |
| - className = "is-primary") |
| 90 | + className = "is-primary", direction="ltr") |
86 | 91 |
|
87 | 92 | T = Observables.to_value(value) isa Vector ? Vector{eltype(vals)} : eltype(vals)
|
88 | 93 | value isa AbstractObservable || (value = Observable{T}(value))
|
89 | 94 |
|
90 | 95 | index = value
|
91 | 96 | orientation = string(orientation)
|
| 97 | + direction = string(direction) |
92 | 98 | preprocess = T<:Vector ? js"unencoded.map(Math.round)" : js"Math.round(unencoded[0])"
|
93 | 99 |
|
94 | 100 | scp = Scope(imports = vcat([nouislider_min_js, nouislider_min_css], libraries(theme)))
|
@@ -122,6 +128,7 @@ function rangeslider(theme::WidgetTheme, vals::AbstractUnitRange{<:Integer}, for
|
122 | 128 | tooltips: $tooltips,
|
123 | 129 | connect: $connect,
|
124 | 130 | orientation: $orientation,
|
| 131 | + direction: $direction, |
125 | 132 | format: {
|
126 | 133 | to: function ( value ) {
|
127 | 134 | var ind = Math.round(value-($min));
|
|
0 commit comments