mirror of https://github.com/espruino/BangleApps
Change order, add more comments for setUI
parent
6fe81e3279
commit
47451511b5
|
@ -154,7 +154,17 @@
|
|||
}
|
||||
};
|
||||
|
||||
// 9. Setup function to configure event handlers
|
||||
// 9. Helper function for touch event
|
||||
let touchInText = function(e, boxItem, boxKey) {
|
||||
calcBoxSize(boxItem);
|
||||
const pos = calcBoxPos(boxKey);
|
||||
return e.x >= pos.x1 &&
|
||||
e.x <= pos.x2 &&
|
||||
e.y >= pos.y1 &&
|
||||
e.y <= pos.y2;
|
||||
};
|
||||
|
||||
// 10. Setup function to configure event handlers
|
||||
let setup = function() {
|
||||
// Define the touchHandler function
|
||||
touchHandler = function(zone, e) {
|
||||
|
@ -208,13 +218,13 @@
|
|||
Bangle.setUI({
|
||||
mode : "clock",
|
||||
remove : function() {
|
||||
// remove the event handlers when the app should be removed
|
||||
// Remove event handlers, stop draw timer, remove custom font if used
|
||||
Bangle.removeListener('touch', touchHandler);
|
||||
Bangle.removeListener('drag', dragHandler);
|
||||
if (drawTimeout) clearTimeout(drawTimeout);
|
||||
drawTimeout = undefined;
|
||||
delete Graphics.prototype.setFontBrunoAce;
|
||||
g.drawString = g_drawString;
|
||||
g.drawString = g_drawString; // Return to original without outlines
|
||||
require("widget_utils").show();
|
||||
}
|
||||
});
|
||||
|
@ -222,16 +232,6 @@
|
|||
draw(boxes);
|
||||
};
|
||||
|
||||
// 10. Helper function for touch event
|
||||
let touchInText = function(e, boxItem, boxKey) {
|
||||
calcBoxSize(boxItem);
|
||||
const pos = calcBoxPos(boxKey);
|
||||
return e.x >= pos.x1 &&
|
||||
e.x <= pos.x2 &&
|
||||
e.y >= pos.y1 &&
|
||||
e.y <= pos.y2;
|
||||
};
|
||||
|
||||
// 11. Main execution part
|
||||
Bangle.loadWidgets();
|
||||
require("widget_utils").swipeOn();
|
||||
|
|
Loading…
Reference in New Issue