Skip to content

Commit fd5235d

Browse files
author
thyttan
committed
spotrem: tweak defaults of dial, call w/o options
1 parent bc0c404 commit fd5235d

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

apps/spotrem/app.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ let dragHandler = function(e) {
128128
// setup volume knob here.
129129
cb(Math.sign(dx))
130130
resetOuterScopeVariables();
131-
let volumeKnob = dial(cb, {stepsPerWholeTurn:7});
131+
let volumeKnob = dial(cb);
132132
let timingOutVolumeKnob = (e)=>{
133133
if (!e.b) {
134134
setKnobTimeout();
@@ -159,27 +159,30 @@ let dragHandler = function(e) {
159159

160160
let dial = function(cb, options) {
161161
"ram";
162-
options = options || {};
163-
164162
const SCREEN_W = g.getWidth();
165163
const SCREEN_H = g.getHeight();
166164

167-
const DIAL_RECT = options.dialRect || {
168-
x: 0,
169-
y: 0,
170-
x2: SCREEN_W - 1,
171-
y2: SCREEN_H - 1,
172-
w: SCREEN_W,
173-
h: SCREEN_H,
174-
};
165+
options = Object.assign(
166+
{ stepsPerWholeTurn : 8,
167+
dialRect : {
168+
x: 0,
169+
y: 0,
170+
x2: SCREEN_W - 1,
171+
y2: SCREEN_H - 1,
172+
w: SCREEN_W,
173+
h: SCREEN_H,
174+
},
175+
}, options);
176+
177+
const DIAL_RECT = options.dialRect;
175178

176179
const CENTER = {
177180
x: DIAL_RECT.x + DIAL_RECT.w / 2,
178181
y: DIAL_RECT.y + DIAL_RECT.h / 2,
179182
};
180183

181184
const BASE_SCREEN_W = 176;
182-
const STEPS_PER_TURN = options.stepsPerWholeTurn || 10;
185+
const STEPS_PER_TURN = options.stepsPerWholeTurn;
183186
const BASE_THRESHOLD = 50;
184187
const THRESHOLD =
185188
BASE_THRESHOLD *
@@ -226,7 +229,7 @@ let dial = function(cb, options) {
226229

227230
E.stopEventPropagation();
228231
}
229-
232+
230233
return onDrag;
231234
/*
232235
if (exports.dial._handler) {

0 commit comments

Comments
 (0)