@@ -19,16 +19,15 @@ function DialDisplay(options) {
1919
2020DialDisplay . prototype . reset = function ( ) {
2121 this . isFirstDraw = true ;
22+ this . prevDrawnValue = null ;
2223} ;
2324
2425DialDisplay . prototype . set = function ( value ) {
25- this . prevValue = this . value ;
2626 this . value = value ;
2727} ;
2828
2929DialDisplay . prototype . step = function ( step ) {
3030 "ram" ;
31- let prevValue = this . prevValue != null ? this . prevValue : this . value ;
3231 this . value += step ;
3332 //g.setFont("Vector:30");
3433 //g.drawString(this.value);
@@ -58,11 +57,11 @@ DialDisplay.prototype.step = function(step) {
5857
5958 //drawCircle(this.value, 1, 1, 1, 2, false);
6059 //drawCircle(prevValue, 0, 0, 0, 2, false);
61- g . setColor ( 0 , 0 , 0 ) . drawLine ( CENTER . x , CENTER . y , CENTER . x + 23 * Math . sin ( prevValue * ( 2 * Math . PI / this . options . stepsPerWholeTurn ) ) , CENTER . y - 23 * Math . cos ( prevValue * ( 2 * Math . PI / this . options . stepsPerWholeTurn ) ) ) ;
60+ g . setColor ( 0 , 0 , 0 ) . drawLine ( CENTER . x , CENTER . y , CENTER . x + 23 * Math . sin ( this . prevDrawnValue * ( 2 * Math . PI / this . options . stepsPerWholeTurn ) ) , CENTER . y - 23 * Math . cos ( this . prevDrawnValue * ( 2 * Math . PI / this . options . stepsPerWholeTurn ) ) ) ;
6261 g . setColor ( 1 , 1 , 1 ) . drawLine ( CENTER . x , CENTER . y , CENTER . x + 23 * Math . sin ( this . value * ( 2 * Math . PI / this . options . stepsPerWholeTurn ) ) , CENTER . y - 23 * Math . cos ( this . value * ( 2 * Math . PI / this . options . stepsPerWholeTurn ) ) ) ;
6362 g . setColor ( 0 , 0 , 0 ) . fillCircle ( CENTER . x , CENTER . y , 9 ) ;
6463
65- delete this . prevValue ;
64+ this . prevDrawnValue = this . value ;
6665} ;
6766
6867exports = DialDisplay ;
0 commit comments