canvas: clean

This commit is contained in:
bordun 2018-01-23 10:15:25 +01:00
parent 6a73a4b1f2
commit 2ff9c52f45
2 changed files with 9 additions and 15 deletions

View file

@ -100,21 +100,17 @@ module.exports = class _canvas_base extends _widgets_base {
var {width, height, style, checkColors} = event,
ratio = CANVAS_SCALING * this.scaling
if (width && height) {
this.height = height
this.width = width
this.height = height
this.width = width
this.canvas.setAttribute('width', width * ratio)
this.canvas.setAttribute('height', height * ratio)
this.canvas.setAttribute('width', width * ratio)
this.canvas.setAttribute('height', height * ratio)
this.clearRect = []
if (ratio != 1) {
this.ctx.setTransform(1, 0, 0, 1, 0, 0)
this.ctx.scale(ratio, ratio)
}
this.clearRect = []
if (ratio != 1) {
this.ctx.setTransform(1, 0, 0, 1, 0, 0)
this.ctx.scale(ratio, ratio)
}
if (!this.visible || checkColors) {
@ -160,7 +156,7 @@ module.exports = class _canvas_base extends _widgets_base {
batchDraw() {
canvasQueue.push(this)
if (this.visible) canvasQueue.push(this)
}

View file

@ -140,8 +140,6 @@ module.exports = class Knob extends _sliders_base {
draw() {
if (!this.width || !this.height) return
var tiny = this.minDimension < 45 * PXSCALE,
margin = tiny ? 0 : 3 * PXSCALE