align option for fader

This commit is contained in:
jean-emmanuel 2016-03-22 22:28:57 +01:00
parent 14868f3b78
commit b06bad1596
4 changed files with 36 additions and 2 deletions

File diff suppressed because one or more lines are too long

View file

@ -17,6 +17,7 @@ module.exports.options = {
top:'auto',
width:'auto',
height:'auto',
align:'center',
horizontal:false,
color:'auto',
css:'',
@ -61,7 +62,12 @@ module.exports.create = function(widgetData,container) {
roundFactor = Math.pow(10,widgetData.precision)
if (widgetData.horizontal) container.addClass('horizontal')
if (widgetData.horizontal) {
container.addClass('horizontal')
delete widgetData.align
} else {
container.addClass('align-'+widgetData.align)
}
handle.size = 0
fader.size = 0

View file

@ -3,6 +3,33 @@
min-height: 200rem;
height:100%;
&.align-right .fader-wrapper {
.fader {
margin-left:calc(50% + 15rem);
&:before {
box-shadow: 20rem 0 0 35rem;
}
}
.meter-container {
-webkit-mask:none;
right:auto!important;
width:1rem;
}
}
&.align-left .fader-wrapper {
.fader {
margin-right:calc(50% + 15rem);
&:before {
box-shadow: -20rem 0 0 35rem;
}
}
.meter-container {
-webkit-mask:none;
left:auto!important;
width:1rem;
}
}
.input {
margin-top:-5rem;
}

View file

@ -6,6 +6,7 @@ Sliders are unidimensional widgets that output one value at a time.
```js
type:'fader',
horizontal:false, // [bool] set to true to display fader horizontally
align:'center', // [left|right] only display one scale and one meter
range: {"min":0,"max":1}, // [object] defining the breakpoints of the fader
// keys can be percentages or 'min' / 'max'
logScale: false, // [bool] use logarithmic scale (log10)