multixy: nicer knobs and tiny perf improvement

This commit is contained in:
jean-emmanuel 2016-11-07 09:04:21 +01:00
parent 654caea96e
commit 4ac7a41b10
2 changed files with 11 additions and 4 deletions

View file

@ -9,7 +9,8 @@
- launcher displays options descriptions for booleans too
- widgets
- added generic `value` option for setting a widget's initial value (does not sync linked widget nor send osc message)
- **text** widget's `defaultText` replaced with `value`
- **text** widget's `defaultText` replaced with `value`
- multixy dots are drawn with filled background instead of stroke
## 0.10.4

View file

@ -139,18 +139,24 @@ MultiXy.prototype.draw = function(){
this.ctx.fillStyle = this.colors.text
this.ctx.lineWidth = PXSCALE
this.ctx.strokeStyle = this.colors.custom
this.ctx.textAlign = 'center'
this.ctx.textBaseline = 'middle'
for (var i=0;i<this.widgetData.points;i++) {
var x = clip(this.pads[i].faders.x.percent,[0,100]) / 100 * (this.width - (this.pointSize * 2 + 2) * PXSCALE) + (this.pointSize + 1) * PXSCALE,
y = (100 - clip(this.pads[i].faders.y.percent,[0,100])) / 100 * (this.height - (this.pointSize * 2 + 2) * PXSCALE) + (this.pointSize + 1) * PXSCALE
this.ctx.save()
this.ctx.globalAlpha = 0.3
this.ctx.fillStyle = this.colors.custom
this.ctx.beginPath()
this.ctx.arc(x, y, this.pointSize * PXSCALE, Math.PI * 2, false)
this.ctx.stroke()
this.ctx.fill()
this.ctx.restore()
this.ctx.font = PXSCALE * 11 + 'px Droid Sans'
this.ctx.textAlign = 'center'
this.ctx.textBaseline = 'middle'
this.ctx.fillText(i,x,y)
}