mirror of https://github.com/espruino/BangleApps
widclose: new widget: a Close Button
parent
aa3bf728fa
commit
d8080a9d6e
|
@ -0,0 +1 @@
|
|||
0.01: New widget!
|
|
@ -0,0 +1,7 @@
|
|||
# Close Button
|
||||
|
||||
Adds a  button to close the current app and go back to the clock.
|
||||
(Widget is not visible on the clock screen)
|
||||
|
||||

|
||||

|
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"id": "widclose",
|
||||
"name": "Close Button",
|
||||
"version": "0.01",
|
||||
"description": "A button to close the current app",
|
||||
"readme": "README.md",
|
||||
"icon": "icon.png",
|
||||
"type": "widget",
|
||||
"tags": "widget,tools",
|
||||
"supports": ["BANGLEJS2"],
|
||||
"screenshots": [{"url":"screenshot_light.png"},{"url":"screenshot_dark.png"}],
|
||||
"storage": [
|
||||
{"name":"widclose.wid.js","url":"widget.js"}
|
||||
]
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 261 B |
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
|
@ -0,0 +1,14 @@
|
|||
if (!Bangle.CLOCK) WIDGETS.close = {
|
||||
area: "tr", width: 24, sortorder: 10, // we want the right-most spot please
|
||||
draw: function() {
|
||||
Bangle.removeListener("touch", this.touch);
|
||||
Bangle.on("touch", this.touch);
|
||||
g.reset().setColor("#f00").drawImage(atob( // hardcoded red to match setUI back button
|
||||
// b/w version of preview.png, 24x24
|
||||
"GBgBABgAAf+AB//gD//wH//4P//8P//8fn5+fjx+fxj+f4H+/8P//8P/f4H+fxj+fjx+fn5+P//8P//8H//4D//wB//gAf+AABgA"
|
||||
), this.x, this.y);
|
||||
}, touch: function(_, c) {
|
||||
const w = WIDGETS.close;
|
||||
if (w && c.x>=w.x && c.x<=w.x+24 && c.y>=w.y && c.y<=w.y+24) load();
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue