Skip to content

Commit 2d17d4d

Browse files
author
thyttan
committed
spotrem: integrate dial graphics
1 parent 9cae2a9 commit 2d17d4d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

apps/spotrem/app.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ let volumeChangedThisGoAround = false;
103103
let knobTimeout;
104104
let dragHandler = function(e) {
105105

106+
let DialDisplay = require("Dial_Display");
107+
let volumeKnobVisual = new DialDisplay();
108+
106109
let cb = ud => {
107110
Bangle.musicControl(ud<0 ? "volumedown" : "volumeup");
108111
Bangle.buzz(20);
@@ -126,9 +129,10 @@ let dragHandler = function(e) {
126129

127130
if (volumeChangedThisGoAround && Math.abs(dx)>32) {
128131
// setup volume knob here.
129-
cb(Math.sign(dx))
132+
let cbVisual = (step, value, reinit)=>{cb(step); volumeKnobVisual(step, value, reinit)};
133+
cbVisual(Math.sign(dx)*Math.sign(g.getHeight()/2-e.y), 0, true)
130134
resetOuterScopeVariables();
131-
let volumeKnob = require("Dial")(cb);
135+
let volumeKnob = require("Dial")(cbVisual);
132136
let timingOutVolumeKnob = (e)=>{
133137
if (!e.b) {
134138
setKnobTimeout();
@@ -147,6 +151,7 @@ let dragHandler = function(e) {
147151
Bangle.removeListener("swipe", swipeMask);
148152
Bangle.buzz(40);
149153
setTimeout(Bangle.buzz, 150, 40, 0.8)
154+
gfx();
150155
knobTimeout = undefined;
151156
print("removed volume knob")
152157
}, 350);

0 commit comments

Comments
 (0)