Skip to content

Commit 0d7fb84

Browse files
author
thyttan
committed
Dial_Display: complementary graphics to Dial module
1 parent 656294b commit 0d7fb84

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

modules/Dial_Display.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
let dialDisplayGenerator = function(options) {
2+
3+
let dialDisplay = function(step, previousValue) {
4+
if (!previousValue) previousValue = 0;
5+
let currentValue = previousValue + step;
6+
g.clear().reset().setFont("Vector:30");
7+
g.drawString(currentValue);
8+
9+
return currentValue;
10+
}
11+
return dialDisplay;
12+
}
13+
14+
let options = {};
15+
let dialDisplay = dialDisplayGenerator(options);
16+
let value = 0;
17+
18+
let cb = (step)=>{
19+
print(step);
20+
value = dialDisplay(step, value);
21+
};
22+
23+
let dial = require("Dial")(cb);
24+
Bangle.on("drag", dial);

0 commit comments

Comments
 (0)