fader: optimize compact mode draw by reducing width to 1px and let the css stretching do the magic

This commit is contained in:
jean-emmanuel 2017-04-27 15:52:11 +02:00
parent b20a9716b5
commit c299c92f09

View file

@ -157,6 +157,17 @@ module.exports = class Fader extends _sliders_base {
}
resizeHandle(){
super.resizeHandle(...arguments)
if (this.widgetData.compact) {
if (this.widgetData.horizontal) {
this.canvas[0].setAttribute('height', 1)
} else {
this.canvas[0].setAttribute('width', 1)
}
}
}
draw() {
@ -242,8 +253,8 @@ module.exports = class Fader extends _sliders_base {
this.ctx.globalAlpha = 0.75
var y,
min = Math.min(d,o),
max = Math.max(d,o)
min = Math.min(d,o),
max = Math.max(d,o)
this.ctx.beginPath()
for (var i = 1;i < this.rangeKeys.length - 1;i++) {