Skip to content

Commit 5ed691b

Browse files
author
thyttan
committed
Dial_Display: improve docs
1 parent 15ceb23 commit 5ed691b

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

modules/Dial_Display.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Bangle.js Dial Display Library
2+
======================
3+
4+
5+
> Take a look at README.md for hints on developing with this library.
6+
7+
Usage
8+
-----
9+
10+
```JS
11+
var DialDisplay = require("Dial_Display");
12+
var dialDisplay = new DialDisplay(options);
13+
```
14+
15+
For example in use with the Dial module:
16+
17+
```JS
18+
var options = {
19+
stepsPerWholeTurn : 6,
20+
dialRect : {
21+
x: 0,
22+
y: 0,
23+
w: g.getWidth()/2,
24+
h: g.getHeight()/2,
25+
}
26+
}
27+
28+
var DialDisplay = require("Dial_Display");
29+
var dialDisplay = new DialDisplay(options);
30+
31+
var cb = (step)=>{
32+
var value = dialDisplay(step);
33+
};
34+
35+
var Dial = require("Dial");
36+
var dial = new Dial(cb, options)
37+
Bangle.on("drag", dial);
38+
```
39+
40+
`options` (first argument) (optional) is an object containing:
41+
42+
`stepsPerWholeTurn` - how many steps there are in one complete turn of the dial.
43+
`dialRect` - decides the area of the screen the dial is set up on.
44+
45+
Defaults:
46+
```js
47+
{ stepsPerWholeTurn : 7
48+
dialRect : {
49+
x: 0,
50+
y: 0,
51+
w: g.getWidth(),
52+
h: g.getHeight(),
53+
},
54+
}
55+
```
56+

0 commit comments

Comments
 (0)