knob: 360° pips fix

This commit is contained in:
jean-emmanuel 2017-07-12 21:26:47 +02:00
parent edd25d4cd6
commit 6d4126cd29

View file

@ -169,8 +169,8 @@ module.exports = class Knob extends _sliders_base {
r2 = pipsRadius + pipsWidth / 2,
a = 2 * Math.PI - this.percentToAngle(pip)
if (pip == 0) a += 1.5 * PXSCALE / pipsRadius
if (pip == 100) a -= 1.5 * PXSCALE / pipsRadius
if (pip == 0 && this.maxAngle != 360) a += 1.5 * PXSCALE / pipsRadius
if (pip == 100 && this.maxAngle != 360) a -= 1.5 * PXSCALE / pipsRadius
this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a))
this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a))