ptlaunch: Make tap to confirm new pattern more reliable. Also allow for easier creation of single circle patterns.

pull/1051/head
crazysaem 2021-12-10 14:41:49 +00:00
parent 6b2f8e98d3
commit 854d2f9ade
4 changed files with 16 additions and 1 deletions

View File

@ -4829,7 +4829,7 @@
"id": "ptlaunch",
"name": "Pattern Launcher",
"shortName": "Pattern Launcher",
"version": "0.02",
"version": "0.03",
"description": "Directly launch apps from the clock screen with custom patterns.",
"icon": "app.png",
"tags": "tools",

View File

@ -1,2 +1,3 @@
0.01: Initial creation of the pattern launch app
0.02: Turn on lcd when launching an app if the lock screen was disabled in the settings
0.03: Make tap to confirm new pattern more reliable. Also allow for easier creation of single circle patterns.

View File

@ -18,6 +18,7 @@ From the main menu you can:
- Add a new pattern and link it to an app (first entry)
- To create a new pattern first select "Add Pattern"
- Now draw any pattern you like, this will later launch the linked app from the clock screen
- You can also draw a single-circle pattern (meaning a single tap on one circle) instead of drawing a 'complex' pattern
- If you don't like the pattern, simply re-draw it. The previous pattern will be discarded.
- If you are happy with the pattern tap on screen or press the button to continue
- Now select the app you want to launch with the pattern.

View File

@ -147,13 +147,26 @@ var createPattern = () => {
setWatch(() => finishHandler(), BTN);
setTimeout(() => Bangle.on("tap", finishHandler), 250);
positions = [];
var dragHandler = (position) => {
log(position);
positions.push(position);
debounce().then(() => {
if (isFinished) {
return;
}
// This might actually be a 'tap' event.
// Use this check in addition to the actual tap handler to make it more reliable
if (pattern.length > 0 && positions.length === 2) {
if (positions[0].x === positions[1].x && positions[0].y === positions[1].y) {
finishHandler();
positions = [];
return;
}
}
E.showMessage("Calculating...");
var t0 = Date.now();