draguboard: Compat w backswipe on newer firmwares

master
thyttan 2023-07-31 20:48:30 +02:00
parent 4061bd2f5e
commit 92e2f4695c
3 changed files with 40 additions and 30 deletions

View File

@ -1 +1,3 @@
0.01: New App based on dragboard, but with a U shaped drag area 0.01: New App based on dragboard, but with a U shaped drag area
0.02: Catch and discard swipe events on fw2v19 and up (as well as some cutting
edge 2v18 ones), allowing compatability with the Back Swipe app.

View File

@ -104,16 +104,7 @@ exports.input = function(options) {
} }
} }
return new Promise((resolve,reject) => { let dragHandlerUB = function(event) {
// Interpret touch input
Bangle.setUI({
mode: 'custom',
back: ()=>{
Bangle.setUI();
g.clearRect(Bangle.appRect);
resolve(text);
},
drag: function(event) {
"ram"; "ram";
// drag on middle bottom rectangle // drag on middle bottom rectangle
@ -141,8 +132,25 @@ exports.input = function(options) {
prevChar = null; prevChar = null;
updateTopString(); updateTopString();
} }
} };
let catchSwipe = (_,__)=>{
E.stopEventPropagation&&E.stopEventPropagation();
};
return new Promise((resolve,reject) => {
// Interpret touch input
Bangle.setUI({
mode: 'custom',
back: ()=>{
Bangle.setUI();
Bangle.prependListener&&Bangle.removeListener('swipe', catchSwipe); // Remove swipe lister if it was added with `Bangle.prependListener()` (fw2v19 and up).
g.clearRect(Bangle.appRect);
resolve(text);
},
drag: dragHandlerDB
}); });
Bangle.prependListener&&Bangle.prependListener('swipe', catchSwipe); // Intercept swipes on fw2v19 and later. Should not break on older firmwares.
R = Bangle.appRect; R = Bangle.appRect;
MIDPADDING = R.x + 35; MIDPADDING = R.x + 35;

View File

@ -1,6 +1,6 @@
{ "id": "draguboard", { "id": "draguboard",
"name": "DragUboard", "name": "DragUboard",
"version":"0.01", "version":"0.02",
"description": "A library for text input via swiping U-shaped keyboard.", "description": "A library for text input via swiping U-shaped keyboard.",
"icon": "app.png", "icon": "app.png",
"type":"textinput", "type":"textinput",