mirror of https://github.com/espruino/BangleApps
Merge pull request #2934 from thyttan/dragboard
dragboard: Compat w backswipe on newer firmwarespull/2936/head
commit
4061bd2f5e
|
@ -5,3 +5,6 @@
|
||||||
0.05: Now scrolls text when string gets longer than screen width.
|
0.05: Now scrolls text when string gets longer than screen width.
|
||||||
0.06: The code is now more reliable and the input snappier. Widgets will be drawn if present.
|
0.06: The code is now more reliable and the input snappier. Widgets will be drawn if present.
|
||||||
0.07: Settings for display colors
|
0.07: Settings for display colors
|
||||||
|
some characters.
|
||||||
|
0.08: Catch and discard swipe events on fw2v19 and up (as well as some cutting
|
||||||
|
edge 2v18 ones), allowing compatability with the Back Swipe app.
|
||||||
|
|
|
@ -103,26 +103,7 @@ exports.input = function(options) {
|
||||||
initDraw();
|
initDraw();
|
||||||
//setTimeout(initDraw, 0); // So Bangle.appRect reads the correct environment. It would draw off to the side sometimes otherwise.
|
//setTimeout(initDraw, 0); // So Bangle.appRect reads the correct environment. It would draw off to the side sometimes otherwise.
|
||||||
|
|
||||||
function changeCase(abcHL) {
|
let dragHandlerDB = function(event) {
|
||||||
if (settings.uppercase) return;
|
|
||||||
g.setColor(BGCOLOR);
|
|
||||||
g.setFontAlign(-1, -1, 0);
|
|
||||||
g.drawString(ABC, ABCPADDING, (R.y+R.h)/2);
|
|
||||||
if (ABC.charAt(abcHL) == ABC.charAt(abcHL).toUpperCase()) ABC = ABC.toLowerCase();
|
|
||||||
else ABC = ABC.toUpperCase();
|
|
||||||
g.setColor(ABCCOLOR);
|
|
||||||
g.drawString(ABC, ABCPADDING, (R.y+R.h)/2);
|
|
||||||
}
|
|
||||||
return new Promise((resolve,reject) => {
|
|
||||||
// Interpret touch input
|
|
||||||
Bangle.setUI({
|
|
||||||
mode: 'custom',
|
|
||||||
back: ()=>{
|
|
||||||
Bangle.setUI();
|
|
||||||
g.clearRect(Bangle.appRect);
|
|
||||||
resolve(text);
|
|
||||||
},
|
|
||||||
drag: function(event) {
|
|
||||||
"ram";
|
"ram";
|
||||||
// ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
// ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||||
// Choose character by draging along red rectangle at bottom of screen
|
// Choose character by draging along red rectangle at bottom of screen
|
||||||
|
@ -243,7 +224,34 @@ exports.input = function(options) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
let catchSwipe = (_,__)=>{
|
||||||
|
E.stopEventPropagation&&E.stopEventPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
|
function changeCase(abcHL) {
|
||||||
|
if (settings.uppercase) return;
|
||||||
|
g.setColor(BGCOLOR);
|
||||||
|
g.setFontAlign(-1, -1, 0);
|
||||||
|
g.drawString(ABC, ABCPADDING, (R.y+R.h)/2);
|
||||||
|
if (ABC.charAt(abcHL) == ABC.charAt(abcHL).toUpperCase()) ABC = ABC.toLowerCase();
|
||||||
|
else ABC = ABC.toUpperCase();
|
||||||
|
g.setColor(ABCCOLOR);
|
||||||
|
g.drawString(ABC, ABCPADDING, (R.y+R.h)/2);
|
||||||
|
}
|
||||||
|
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.
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ "id": "dragboard",
|
{ "id": "dragboard",
|
||||||
"name": "Dragboard",
|
"name": "Dragboard",
|
||||||
"version":"0.07",
|
"version":"0.08",
|
||||||
"description": "A library for text input via swiping keyboard",
|
"description": "A library for text input via swiping keyboard",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"type":"textinput",
|
"type":"textinput",
|
||||||
|
|
Loading…
Reference in New Issue