canvas widget: optimize css color vars get; fix multixy resize handler

This commit is contained in:
jean-emmanuel 2016-12-13 08:14:27 +01:00
parent 06b22245b1
commit 53c1475e0f
3 changed files with 12 additions and 10 deletions

View file

@ -52,12 +52,13 @@ _canvas_base.prototype.resizeHandle = function(e, width, height, checkColors){
if (!this.visible || checkColors) {
this.visible = true
this.colors.custom = getComputedStyle(this.widget[0]).getPropertyValue('--color-custom')
this.colors.text = getComputedStyle(this.widget[0]).getPropertyValue('--color-text')
this.colors.raised = getComputedStyle(this.widget[0]).getPropertyValue('--color-raised')
this.colors.bg = getComputedStyle(this.widget[0]).getPropertyValue('--color-bg')
this.colors.fg = getComputedStyle(this.widget[0]).getPropertyValue('--color-fg')
this.colors.faded = getComputedStyle(this.widget[0]).getPropertyValue('--color-faded')
var style = getComputedStyle(this.widget[0])
this.colors.custom = style.getPropertyValue('--color-custom')
this.colors.text = style.getPropertyValue('--color-text')
this.colors.raised = style.getPropertyValue('--color-raised')
this.colors.bg = style.getPropertyValue('--color-bg')
this.colors.fg = style.getPropertyValue('--color-fg')
this.colors.faded = style.getPropertyValue('--color-faded')
}
requestAnimationFrame(this.draw.bind(this))

View file

@ -122,7 +122,7 @@ MultiXy.prototype = Object.create(_pads_base.prototype)
MultiXy.prototype.constructor = MultiXy
MultiXy.prototype.resizeHandle = function(){
_pads_base.prototype.resizeHandle.call(this)
_pads_base.prototype.resizeHandle.apply(this, arguments)
this.updateHandlesPosition()
}

View file

@ -119,9 +119,10 @@ _sliders_base.prototype.dragHandle = function(e, data, traversing) {
_sliders_base.prototype.resizeHandle = function(e, width, height, checkColors) {
if (!this.visible || checkColors) {
this.colors.track = getComputedStyle(this.widget[0]).getPropertyValue('--color-track')
this.colors.gauge = getComputedStyle(this.widget[0]).getPropertyValue('--color-gauge')
this.colors.knob = getComputedStyle(this.widget[0]).getPropertyValue('--color-knob')
var style = getComputedStyle(this.widget[0])
this.colors.track = style.getPropertyValue('--color-track')
this.colors.gauge = style.getPropertyValue('--color-gauge')
this.colors.knob = style.getPropertyValue('--color-knob')
}
_canvas_base.prototype.resizeHandle.apply(this, arguments)
}