@@ -20,11 +20,11 @@ let dialDisplayGenerator = function(options) {
2020 y : DIAL_RECT . y + DIAL_RECT . h / 2 ,
2121 } ;
2222
23- let dialDisplay = function ( step , value ) {
23+ let dialDisplay = function ( step , value , isReinit ) {
2424 let prevValue = this . value ;
25- if ( value ) this . value = value ;
25+ if ( value !== undefined ) this . value = value ;
2626 if ( ! this . value ) this . value = 0 ;
27- if ( this . isFirstDraw === undefined ) this . isFirstDraw = true ;
27+ if ( this . isFirstDraw === undefined || isReinit ) this . isFirstDraw = true ;
2828 this . value += step ;
2929 //g.setFont("Vector:30");
3030 //g.drawString(this.value);
@@ -37,7 +37,7 @@ let dialDisplayGenerator = function(options) {
3737 if ( isFill ) g . fillCircle ( x , y , rad ) ;
3838 }
3939 if ( this . isFirstDraw ) {
40- g . clear ( ) ;
40+ g . setColor ( 0 , 0 , 0 ) . fillCircle ( CENTER . x , CENTER . y , 25 ) ;
4141 g . setColor ( 1 , 1 , 1 ) . drawCircle ( CENTER . x , CENTER . y , 25 ) ;
4242 for ( let i = 0 ; i < options . stepsPerWholeTurn ; i ++ ) {
4343 drawCircle ( i , 1 , 1 , 1 , 1 , true ) ;
@@ -47,8 +47,8 @@ let dialDisplayGenerator = function(options) {
4747
4848 //drawCircle(this.value, 1, 1, 1, 2, false);
4949 //drawCircle(prevValue, 0, 0, 0, 2, false);
50- g . setColor ( 1 , 1 , 1 ) . drawLine ( CENTER . x , CENTER . y , CENTER . x + 23 * Math . sin ( this . value * ( 2 * Math . PI / options . stepsPerWholeTurn ) ) , CENTER . y - 23 * Math . cos ( this . value * ( 2 * Math . PI / options . stepsPerWholeTurn ) ) ) ;
5150 g . setColor ( 0 , 0 , 0 ) . drawLine ( CENTER . x , CENTER . y , CENTER . x + 23 * Math . sin ( prevValue * ( 2 * Math . PI / options . stepsPerWholeTurn ) ) , CENTER . y - 23 * Math . cos ( prevValue * ( 2 * Math . PI / options . stepsPerWholeTurn ) ) ) ;
51+ g . setColor ( 1 , 1 , 1 ) . drawLine ( CENTER . x , CENTER . y , CENTER . x + 23 * Math . sin ( this . value * ( 2 * Math . PI / options . stepsPerWholeTurn ) ) , CENTER . y - 23 * Math . cos ( this . value * ( 2 * Math . PI / options . stepsPerWholeTurn ) ) ) ;
5252 g . setColor ( 0 , 0 , 0 ) . fillCircle ( CENTER . x , CENTER . y , 9 ) ;
5353
5454 return this . value ;
0 commit comments