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'
}