Correct some problems with swipe detection on main clock screen

Increase sensitivity so only a small swipe is needed to switch to the
appropriate screen.

Fix uninitialized variables for calculating swipe length which usually
caused first swipe length to register as NaN.
master
Travis Evans 2023-07-25 16:40:46 -05:00
parent 61a3b406af
commit e851d1321e
4 changed files with 8 additions and 7 deletions

View File

@ -2,3 +2,4 @@
0.02: Add sunrise/sunset. Fix timer bugs.
0.03: Use default Bangle formatter for booleans
0.04: Use 'modules/suncalc.js' to avoid it being copied 8 times for different apps
0.05: Improve responsiveness and detection of swipes on main clock screen

View File

@ -148,23 +148,23 @@ if (process.env.HWVERSION==1) {
setWatch(()=>load("timerclk.alarm.js"), BTN3);
setWatch(()=>load("timerclk.alarm.js"), BTN1);
} else {
var absY, lastX, lastY;
var absY, lastX=0, lastY=0;
Bangle.on('drag', e=>{
if (!e.b) {
if (lastX > 50) { // right
if (lastX > 5) { // right
if (absY < dragBorder) { // drag over time
load("timerclk.timer.js");
}else { // drag over date/dow
load("timerclk.alarm.js");
}
} else if (lastX < -50) { // left
} else if (lastX < -5) { // left
if (absY < dragBorder) { // drag over time
load("timerclk.stopwatch.js");
}else { // drag over date/dow
load("timerclk.alarm.js");
}
} else if (lastY > 50) { // down
} else if (lastY < -50) { // up
} else if (lastY > 5) { // down
} else if (lastY < -5) { // up
}
lastX = 0;
lastY = 0;

View File

@ -87,7 +87,7 @@ exports.registerControls = function(o) {
}
}
});
var absX, lastX, lastY;
var absX, lastX=0, lastY=0;
Bangle.on('drag', e=>{
if (!e.b) {
if (lastX > 40) { // right

View File

@ -2,7 +2,7 @@
"id": "timerclk",
"name": "Timer Clock",
"shortName":"Timer Clock",
"version":"0.04",
"version":"0.05",
"description": "A clock with stopwatches, timers and alarms build in.",
"icon": "app-icon.png",
"type": "clock",