andrepxx / pure-knob

Canvas-based JavaScript UI element implementing touch, keyboard, mouse and scroll wheel support.
Apache License 2.0
52 stars 12 forks source link

Can fail on odd startAngle endAngle #2

Closed gazhay closed 6 years ago

gazhay commented 6 years ago

Dial sticks at 0 when clicked on :

knob.setProperty('angleStart', 1.5Math.PI); knob.setProperty('angleEnd' , 2.0Math.PI); knob.setProperty('trackWidth', 0.4); knob.setProperty('valMin' , 0); knob.setProperty('valMax' , 90); knob.setProperty('needle' , true); knob.setValue(45);

I had originally wanted

knob.setProperty('angleStart', 0); knob.setProperty('angleEnd' , 0.5*Math.PI);

but then I wanted the dial to go anti-clockwise, so tried to swap valMin and valMax but that didn't work, so I tried the code I have above and found it doesn't work either.

gazhay commented 6 years ago

Sorry brainfreeze moment, I used -0.5* Math.PI to 0.