widgets: add encoder

This commit is contained in:
jean-emmanuel 2017-04-26 19:02:27 +02:00
parent 2e7444ae32
commit b978d4b9fe
3 changed files with 31 additions and 3 deletions

View file

@ -2,6 +2,7 @@ var widgets = {
// sliders
fader: require('./widgets/sliders/fader'),
knob: require('./widgets/sliders/knob'),
encoder: require('./widgets/sliders/encoder'),
// buttons
toggle: require('./widgets/buttons/toggle'),
@ -42,7 +43,7 @@ var widgets = {
}
module.exports.categories = {
'Sliders':['fader','knob'],
'Sliders':['fader','knob', 'encoder'],
'Buttons':['toggle','push','switch'],
'Pads':['xy','rgb','multixy'],
'Matrices':['multifader','multitoggle','multipush', 'keyboard'],

View file

@ -142,8 +142,9 @@ module.exports = class Knob extends _sliders_base {
this.minDimension = Math.min(this.width, this.height)
this.gaugeWidth = this.minDimension / 8
if (this.widgetData.compact) {
this.canvas[0].style.top = this.input[0].style.marginTop = (this.minDimension) * this.lostHeightFactor - this.gaugeWidth / 4 + 'px'
this.canvas[0].style.top = this.input[0].style.marginTop = (this.minDimension) * this.lostHeightFactor - (this.widgetData.label === false ? 0 : this.gaugeWidth / 4) + 'px'
} else {
this.canvas[0].style.top = Math.min((this.minDimension) * this.lostHeightFactor - this.margin * PXSCALE / 2, this.input.outerHeight() * .5) + 'px'
}

View file

@ -1,4 +1,4 @@
.knob-container {
.knob-container, .encoder-container {
--color-pips: var(--color-text-fade);
--color-gauge: var(--color-custom);
--color-knob: var(--color-custom);
@ -8,6 +8,7 @@
height: 120rem;
align-items: center;
flex-shrink: 0;
}
.knob {
@ -53,3 +54,28 @@
}
}
}
.encoder {
--color-gauge: transparent;
height:100%;
width: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
position: relative;
.wrapper {
overflow: hidden;
flex:1;
max-height: 100%;
width: 100%;
position: relative;
display: flex;
}
.input {
// display: none;
}
}