1
0
Fork 0

astrocalc: Enable widgets

master
Erik Andresen 2023-07-27 18:26:56 +02:00
parent 4777d98c10
commit cdf3486ab6
3 changed files with 9 additions and 14 deletions

View File

@ -2,3 +2,4 @@
0.02: Store last GPS lock, can be used instead of waiting for new GPS on start 0.02: Store last GPS lock, can be used instead of waiting for new GPS on start
0.03: Use 'modules/suncalc.js' to avoid it being copied 8 times for different apps 0.03: Use 'modules/suncalc.js' to avoid it being copied 8 times for different apps
0.04: Compatibility with Bangle.js 2, get location from My Location 0.04: Compatibility with Bangle.js 2, get location from My Location
0.05: Enable widgets

View File

@ -110,7 +110,7 @@ function drawPoints() {
} }
function drawData(title, obj, startX, startY) { function drawData(title, obj, startX, startY) {
g.clear(); g.clearRect(Bangle.appRect);
drawTitle(title); drawTitle(title);
let xPos, yPos; let xPos, yPos;
@ -154,9 +154,7 @@ function drawMoonPositionPage(gps, title) {
drawPoints(); drawPoints();
drawPoint(azimuthDegrees, 8, moonColor); drawPoint(azimuthDegrees, 8, moonColor);
let m = setWatch(() => { Bangle.setUI({mode: "custom", back: () => moonIndexPageMenu(gps)});
let m = moonIndexPageMenu(gps);
}, BANGLEJS2 ? BTN : BTN3, {repeat: false, edge: "falling"});
} }
function drawMoonIlluminationPage(gps, title) { function drawMoonIlluminationPage(gps, title) {
@ -174,9 +172,7 @@ function drawMoonIlluminationPage(gps, title) {
drawData(title, pageData, null, 35); drawData(title, pageData, null, 35);
drawMoon(phaseIdx, g.getWidth() / 2, g.getHeight() / 2); drawMoon(phaseIdx, g.getWidth() / 2, g.getHeight() / 2);
let m = setWatch(() => { Bangle.setUI({mode: "custom", back: () => moonIndexPageMenu(gps)});
let m = moonIndexPageMenu(gps);
}, BANGLEJS2 ? BTN : BTN3, {repease: false, edge: "falling"});
} }
@ -202,9 +198,7 @@ function drawMoonTimesPage(gps, title) {
const setAzimuthDegrees = parseInt(setPos.azimuth * 180 / Math.PI); const setAzimuthDegrees = parseInt(setPos.azimuth * 180 / Math.PI);
drawPoint(setAzimuthDegrees, 8, moonColor); drawPoint(setAzimuthDegrees, 8, moonColor);
let m = setWatch(() => { Bangle.setUI({mode: "custom", back: () => moonIndexPageMenu(gps)});
let m = moonIndexPageMenu(gps);
}, BANGLEJS2 ? BTN : BTN3, {repease: false, edge: "falling"});
} }
function drawSunShowPage(gps, key, date) { function drawSunShowPage(gps, key, date) {
@ -233,9 +227,7 @@ function drawSunShowPage(gps, key, date) {
// Draw the suns position // Draw the suns position
drawPoint(azimuthDegrees, 8, {r: 1, g: 1, b: 0}); drawPoint(azimuthDegrees, 8, {r: 1, g: 1, b: 0});
m = setWatch(() => { Bangle.setUI({mode: "custom", back: () => sunIndexPageMenu(gps)});
m = sunIndexPageMenu(gps);
}, BANGLEJS2 ? BTN : BTN3, {repeat: false, edge: "falling"});
return null; return null;
} }
@ -314,7 +306,9 @@ function getCenterStringX(str) {
function init() { function init() {
let location = require("Storage").readJSON("mylocation.json",1)||{"lat":51.5072,"lon":0.1276,"location":"London"}; let location = require("Storage").readJSON("mylocation.json",1)||{"lat":51.5072,"lon":0.1276,"location":"London"};
Bangle.loadWidgets();
indexPageMenu(location); indexPageMenu(location);
Bangle.drawWidgets();
} }
let m; let m;

View File

@ -1,7 +1,7 @@
{ {
"id": "astrocalc", "id": "astrocalc",
"name": "Astrocalc", "name": "Astrocalc",
"version": "0.04", "version": "0.05",
"description": "Calculates interesting information on the sun like sunset and sunrise and moon cycles for the current day based on your location from MyLocation app", "description": "Calculates interesting information on the sun like sunset and sunrise and moon cycles for the current day based on your location from MyLocation app",
"icon": "astrocalc.png", "icon": "astrocalc.png",
"tags": "app,sun,moon,cycles,tool", "tags": "app,sun,moon,cycles,tool",