Skip to content

Commit 251da4f

Browse files
author
thyttan
committed
Dial_Display: rework method reset into queueRedraw
1 parent 681ce21 commit 251da4f

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

modules/Dial_Display.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ function DialDisplay(options) {
1414
}, options);
1515

1616
this.value = 0;
17-
this.reset();
17+
this.isFullDraw = true;
1818
}
1919

20-
DialDisplay.prototype.reset = function() {
21-
this.isFirstDraw = true;
20+
DialDisplay.prototype.queueRedraw = function() {
21+
this.isFullDraw = true;
2222
this.prevDrawnValue = null;
2323
};
2424

@@ -46,13 +46,13 @@ DialDisplay.prototype.step = function(step) {
4646
if (!isFill) g.drawCircle(x, y, rad);
4747
if (isFill) g.fillCircle(x, y, rad);
4848
}
49-
if (this.isFirstDraw) {
49+
if (this.isFullDraw) {
5050
g.setColor(0,0,0).fillCircle(CENTER.x, CENTER.y, 25);
5151
g.setColor(1,1,1).drawCircle(CENTER.x, CENTER.y, 25);
5252
for (let i=0; i<this.options.stepsPerWholeTurn; i++) {
5353
drawCircle(i, 1, 1, 1, 1, true);
5454
}
55-
this.isFirstDraw = false;
55+
this.isFullDraw = false;
5656
}
5757

5858
//drawCircle(this.value, 1, 1, 1, 2, false);

modules/Dial_Display.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dialDisplay.step(-1);
1616
var value = dialDisplay.value;
1717

1818
// ... after some time:
19-
dialDisplay.reset();
19+
dialDisplay.queueRedraw();
2020
dialDisplay.set(0);
2121
```
2222

@@ -37,7 +37,6 @@ var DialDisplay = require("Dial_Display");
3737
var dialDisplay = new DialDisplay(options);
3838

3939
var cb = (step) => {
40-
dialDisplay.reset();
4140
dialDisplay.step(step);
4241
};
4342

@@ -65,7 +64,7 @@ Defaults:
6564
The Dial Display has three functions:
6665
`step(amount)` - +1 or -1 to step the dial.
6766
`set(value)` - set the value for the next `step()` to act on.
68-
`reset()` - draw all of the dial (instead of just the indicator) on the next `step()`.
67+
`queueRedraw()` - draw all of the dial (instead of just the indicator) on the next `step()`.
6968

7069
Notes:
7170
======

0 commit comments

Comments
 (0)