DetailPage: guardie port undefined, log init/refresh, Z0 tratteggiata manuale (no setLineDash Qt5.6)
This commit is contained in:
@@ -27,6 +27,11 @@ Page {
|
|||||||
function init() {
|
function init() {
|
||||||
nearPort = null
|
nearPort = null
|
||||||
nearKm = 0
|
nearKm = 0
|
||||||
|
console.log("[tide] DetailPage.init custom:", custom, "port:", port ? port[0] : "UNDEFINED")
|
||||||
|
if (!port) {
|
||||||
|
console.log("[tide] DetailPage.init: port undefined, niente da caricare")
|
||||||
|
return
|
||||||
|
}
|
||||||
if (custom && port.length > 5 && port[5] !== "") {
|
if (custom && port.length > 5 && port[5] !== "") {
|
||||||
var np = Tides.nearestPort(port[2], port[3])
|
var np = Tides.nearestPort(port[2], port[3])
|
||||||
if (np.port !== null) {
|
if (np.port !== null) {
|
||||||
@@ -38,7 +43,12 @@ Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
if (!port) return
|
if (!port) {
|
||||||
|
console.log("[tide] refresh: port UNDEFINED")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log("[tide] refresh:", port[0], "days:", days, "unit:", unit)
|
||||||
|
try {
|
||||||
// eventi
|
// eventi
|
||||||
eventsModel.clear()
|
eventsModel.clear()
|
||||||
var ex = Tides.extrema(port, new Date(), days)
|
var ex = Tides.extrema(port, new Date(), days)
|
||||||
@@ -68,6 +78,9 @@ Page {
|
|||||||
curveInfo.text = qsTr("Z₀ %1 m · 7 harmonic constituents").arg(port[4][0].toFixed(2))
|
curveInfo.text = qsTr("Z₀ %1 m · 7 harmonic constituents").arg(port[4][0].toFixed(2))
|
||||||
}
|
}
|
||||||
cv.requestPaint()
|
cv.requestPaint()
|
||||||
|
} catch (e) {
|
||||||
|
console.log("[tide] refresh error:", e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property var moonNames: [
|
property var moonNames: [
|
||||||
@@ -300,11 +313,15 @@ Page {
|
|||||||
ctx.fillText((d.getHours() < 10 ? "0" : "") + d.getHours() + ":00", x + 3, h - 3)
|
ctx.fillText((d.getHours() < 10 ? "0" : "") + d.getHours() + ":00", x + 3, h - 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z0 tratteggiata
|
// Z0 tratteggiata (disegno manuale: setLineDash non garantito su Qt 5.6)
|
||||||
ctx.setLineDash([4, 4])
|
|
||||||
ctx.strokeStyle = Theme.rgba(Theme.secondaryColor, 0.6)
|
ctx.strokeStyle = Theme.rgba(Theme.secondaryColor, 0.6)
|
||||||
ctx.beginPath(); ctx.moveTo(pad, Y(port[4][0])); ctx.lineTo(w - pad, Y(port[4][0])); ctx.stroke()
|
var zy = Y(port[4][0])
|
||||||
ctx.setLineDash([])
|
for (var zx = pad; zx < w - pad; zx += 10) {
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.moveTo(zx, zy)
|
||||||
|
ctx.lineTo(Math.min(zx + 5, w - pad), zy)
|
||||||
|
ctx.stroke()
|
||||||
|
}
|
||||||
|
|
||||||
// curva
|
// curva
|
||||||
ctx.strokeStyle = Theme.highlightColor
|
ctx.strokeStyle = Theme.highlightColor
|
||||||
|
|||||||
Reference in New Issue
Block a user