fastdom: toying around with what works and what doesn't
This commit is contained in:
parent
3e06e52948
commit
e7693d2277
6 changed files with 46 additions and 39 deletions
|
|
@ -89,12 +89,18 @@ class Canvas extends Widget {
|
|||
this.container.style.setProperty('--widget-height', this.height + 'rem')
|
||||
this.container.style.setProperty('--widget-width', this.width + 'rem')
|
||||
|
||||
this.ctx.font = this.fontWeight + ' ' + this.fontSize + 'px ' + this.fontFamily
|
||||
this.ctx.textBaseline = 'middle'
|
||||
this.ctx.textAlign = this.textAlign
|
||||
|
||||
if (!this.hasSize) {
|
||||
this.hasSize = true
|
||||
this.setVisibility()
|
||||
this.batchDraw()
|
||||
} else {
|
||||
this.draw()
|
||||
}
|
||||
|
||||
this.batchDraw()
|
||||
})
|
||||
})
|
||||
|
||||
|
|
@ -137,11 +143,6 @@ class Canvas extends Widget {
|
|||
this.fontSize = parseFloat(style.getPropertyValue('font-size').trim())
|
||||
this.fontWeight = parseFloat(style.getPropertyValue('font-weight').trim())
|
||||
|
||||
this.ctx.font = this.fontWeight + ' ' + this.fontSize + 'px ' + this.fontFamily
|
||||
this.ctx.textBaseline = 'middle'
|
||||
this.ctx.textAlign = this.textAlign
|
||||
|
||||
|
||||
}
|
||||
|
||||
clear() {
|
||||
|
|
|
|||
|
|
@ -177,13 +177,15 @@ module.exports = class MultiXy extends Pad {
|
|||
|
||||
super.resizeHandle(event)
|
||||
|
||||
for (var k in this.pads) {
|
||||
this.pads[k].width = this.width
|
||||
this.pads[k].height = this.height
|
||||
this.pads[k].padPadding = this.padPadding
|
||||
}
|
||||
fastdom.measure(()=>{
|
||||
for (var k in this.pads) {
|
||||
this.pads[k].width = this.width
|
||||
this.pads[k].height = this.height
|
||||
this.pads[k].padPadding = this.padPadding
|
||||
}
|
||||
this.updateHandlesPosition()
|
||||
})
|
||||
|
||||
this.updateHandlesPosition()
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
var Pad = require('./pad'),
|
||||
Fader = require('../sliders/fader'),
|
||||
doubletab = require('../mixins/double_tap'),
|
||||
touchstate = require('../mixins/touch_state')
|
||||
touchstate = require('../mixins/touch_state'),
|
||||
fastdom = require('fastdom')
|
||||
|
||||
var faderDefaults = Fader.defaults()._props()
|
||||
|
||||
|
|
@ -156,12 +157,15 @@ module.exports = class Xy extends Pad {
|
|||
|
||||
super.resizeHandle(event)
|
||||
|
||||
for (var k in this.faders) {
|
||||
this.faders[k].width = this.width
|
||||
this.faders[k].height = this.height
|
||||
this.faders[k].gaugePadding = this.padPadding
|
||||
|
||||
}
|
||||
fastdom.measure(()=>{
|
||||
fastdom.mutate(()=>{
|
||||
for (var k in this.faders) {
|
||||
this.faders[k].width = this.width
|
||||
this.faders[k].height = this.height
|
||||
this.faders[k].gaugePadding = this.padPadding
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue