Skip to content

Commit c3b5500

Browse files
author
thyttan
committed
dial: wip changes
1 parent db3d2f3 commit c3b5500

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

modules/dial.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@
2020

2121
let dialRect = options.dialRect || {
2222
x: 0, y: 0, x2: g.getWidth(), y2: g.getHeight(),
23-
w: g.getWidth() / 2, h: g.getHeight() / 2
23+
w: g.getWidth(), h: g.getHeight()
2424
};
2525

26-
let triggerDistance = 45; // TODO: triggerDistance -> 45 * g.getWidth() / 176 . To remap to screens of different resolutions.
26+
let stepsPerWholeTurn = options.stepsPerWholeTurn || 10;
27+
let triggerDistance = 50 * (10 / stepsPerWholeTurn) * dialRect.w / 176; // baseDistance * stepsPerWholeTurnScaling * rectangeScaling.
2728

2829
let origo = { x: dialRect.x + dialRect.w / 2, y: dialRect.y + dialRect.h / 2 };
2930
let dragHandler = function (e) {
3031
"ram"
3132

3233
if (!(e.y >= dialRect.y && e.y < dialRect.y2 &&
33-
e.x >= dialRect.x && e.x < dialRect.x2)) {return;}
34+
e.x >= dialRect.x && e.x < dialRect.x2)) { return; }
3435

3536
if (e.y < origo.y) { cumulativeDxPlusDy += e.dx; } else { cumulativeDxPlusDy -= e.dx; }
3637
if (e.x < origo.x) { cumulativeDxPlusDy -= e.dy; } else { cumulativeDxPlusDy += e.dy; }
@@ -54,7 +55,11 @@
5455
Bangle.prependListener("drag", dragHandler);
5556
}
5657

57-
dial(callback);
58+
// Trying it out:
59+
dial(callback, { stepsPerWholeTurn: 15, dialRect: {
60+
x: 0, y: 0, x2: g.getWidth()/2, y2: g.getHeight()/2,
61+
w: g.getWidth()/2, h: g.getHeight()/2
62+
}});
5863
}
5964

6065

0 commit comments

Comments
 (0)