cover: preferito custom (comune) con coordinate salvate (preferredLat/Lon); riga eventi: colonna Alta/Bassa con fade (mai sovrapposta)

This commit is contained in:
2026-09-02 12:41:50 +02:00
parent 4794f5d467
commit 9765250531
5 changed files with 69 additions and 2 deletions
+8
View File
@@ -41,6 +41,7 @@ CoverBackground {
function refresh() {
var pref = appSettings.preferredPort
console.log("[tide] cover refresh, pref:", pref)
if (pref === "") {
portLabel.text = qsTr("No port selected")
nextLabel.text = ""
@@ -50,6 +51,13 @@ CoverBackground {
for (var i = 0; i < Tides.PORTS.length; i++) {
if (Tides.PORTS[i][0] === pref) { p = Tides.PORTS[i]; break }
}
// preferito custom (comune): ricostruisci le costanti da lat/lon
if (!p && appSettings.preferredLat >= 0) {
var np = Tides.nearestPort(appSettings.preferredLat, appSettings.preferredLon)
var cost = np.km < 222 ? np.port[4].slice()
: Tides.synthConst(appSettings.preferredLat, appSettings.preferredLon)
p = [pref, "", appSettings.preferredLat, appSettings.preferredLon, cost, "pref"]
}
if (!p) { portLabel.text = qsTr("No port selected"); nextLabel.text = ""; return }
portLabel.text = p[0]
var ex = Tides.extrema(p, new Date(), 1)