kbswipe: Compat w backswipe on newer firmwares
parent
4061bd2f5e
commit
8ba3c68b59
|
|
@ -6,3 +6,5 @@
|
||||||
0.06: Support input of numbers and uppercase characters.
|
0.06: Support input of numbers and uppercase characters.
|
||||||
0.07: Support input of symbols.
|
0.07: Support input of symbols.
|
||||||
0.08: Redone patterns a,e,m,w,z.
|
0.08: Redone patterns a,e,m,w,z.
|
||||||
|
0.09: Catch and discard swipe events on fw2v19 and up (as well as some cutting
|
||||||
|
edge 2v18 ones), allowing compatability with the Back Swipe app.
|
||||||
|
|
|
||||||
|
|
@ -253,14 +253,15 @@ exports.input = function(options) {
|
||||||
};
|
};
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
|
|
||||||
return new Promise((resolve,reject) => {
|
let dragHandlerKB = e=>{
|
||||||
Bangle.setUI({mode:"custom", drag:e=>{
|
|
||||||
"ram";
|
"ram";
|
||||||
if (isInside(R, e)) {
|
if (isInside(R, e)) {
|
||||||
if (lastDrag) g.reset().setColor("#f00").drawLine(lastDrag.x,lastDrag.y,e.x,e.y);
|
if (lastDrag) g.reset().setColor("#f00").drawLine(lastDrag.x,lastDrag.y,e.x,e.y);
|
||||||
lastDrag = e.b ? e : 0;
|
lastDrag = e.b ? e : 0;
|
||||||
}
|
}
|
||||||
},touch:(n,e) => {
|
}
|
||||||
|
|
||||||
|
let touchHandlerKB = (n,e) => {
|
||||||
if (WIDGETS.kbswipe && isInside({x: WIDGETS.kbswipe.x, y: WIDGETS.kbswipe.y, w: WIDGETS.kbswipe.width, h: 24}, e)) {
|
if (WIDGETS.kbswipe && isInside({x: WIDGETS.kbswipe.x, y: WIDGETS.kbswipe.y, w: WIDGETS.kbswipe.width, h: 24}, e)) {
|
||||||
// touch inside widget
|
// touch inside widget
|
||||||
cycleInput();
|
cycleInput();
|
||||||
|
|
@ -268,13 +269,22 @@ exports.input = function(options) {
|
||||||
// touch inside app area
|
// touch inside app area
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
}, back:()=>{
|
}
|
||||||
|
|
||||||
|
let catchSwipe = ()=>{
|
||||||
|
E.stopEventPropagation&&E.stopEventPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
|
return new Promise((resolve,reject) => {
|
||||||
|
Bangle.setUI({mode:"custom", drag:dragHandlerKB, touch:touchHandlerKB, back:()=>{
|
||||||
delete WIDGETS.kbswipe;
|
delete WIDGETS.kbswipe;
|
||||||
Bangle.removeListener("stroke", strokeHandler);
|
Bangle.removeListener("stroke", strokeHandler);
|
||||||
|
Bangle.prependListener&&Bangle.removeListener('swipe', catchSwipe); // Remove swipe lister if it was added with `Bangle.prependListener()` (fw2v19 and up).
|
||||||
if (flashInterval) clearInterval(flashInterval);
|
if (flashInterval) clearInterval(flashInterval);
|
||||||
Bangle.setUI();
|
Bangle.setUI();
|
||||||
g.clearRect(Bangle.appRect);
|
g.clearRect(Bangle.appRect);
|
||||||
resolve(text);
|
resolve(text);
|
||||||
}});
|
}});
|
||||||
|
Bangle.prependListener&&Bangle.prependListener('swipe', catchSwipe); // Intercept swipes on fw2v19 and later. Should not break on older firmwares.
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{ "id": "kbswipe",
|
{ "id": "kbswipe",
|
||||||
"name": "Swipe keyboard",
|
"name": "Swipe keyboard",
|
||||||
"version":"0.08",
|
"version":"0.09",
|
||||||
"description": "A library for text input via PalmOS style swipe gestures (beta!)",
|
"description": "A library for text input via PalmOS style swipe gestures (beta!)",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"type":"textinput",
|
"type":"textinput",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue