widgps: Do not take widget space if icon is hidden

pull/2108/head
Erik Andresen 2022-09-02 20:03:50 +02:00
parent 58a200b05d
commit bd829f27e9
6 changed files with 6 additions and 4 deletions

BIN
apps/widgps/.ChangeLog.swp Normal file

Binary file not shown.

Binary file not shown.

BIN
apps/widgps/.widget.js.swp Normal file

Binary file not shown.

View File

@ -6,3 +6,4 @@
0.06: Periodically update so the always on display does show current GPS fix
0.07: Alternative marker icon (configurable via settings)
0.08: Add ability to hide the icon when GPS is off, for a cleaner appearance.
0.09: Do not take widget space if icon is hidden

View File

@ -1,7 +1,7 @@
{
"id": "widgps",
"name": "GPS Widget",
"version": "0.08",
"version": "0.09",
"description": "Tiny widget to show the power and fix status of the GPS/GNSS",
"icon": "widget.png",
"type": "widget",

View File

@ -11,13 +11,14 @@ var interval;
var oldSetGPSPower = Bangle.setGPSPower;
Bangle.setGPSPower = function(on, id) {
var isGPSon = oldSetGPSPower(on, id);
WIDGETS.gps.draw();
WIDGETS.gps.width = !isGPSon && settings.hideWhenGpsOff ? 0 : 24;
Bangle.drawWidgets();
return isGPSon;
};
WIDGETS.gps = {
area : "tr",
width : 24,
width : !Bangle.isGPSOn() && settings.hideWhenGpsOff ? 0 : 24,
draw : function() {
g.reset();