Add tooltips for preplot layers

This commit is contained in:
D. Berge
2025-08-03 11:53:55 +02:00
parent 0f207f8c2d
commit 59a90e352c

View File

@@ -20,6 +20,8 @@ export default {
return this.eventLogTooltip(args); return this.eventLogTooltip(args);
} else if (args?.layer?.id == "pplp" || args?.layer?.id == "pslp") { } else if (args?.layer?.id == "pplp" || args?.layer?.id == "pslp") {
return this.preplotPointsTooltip(args); return this.preplotPointsTooltip(args);
} else if (args?.layer?.id == "ppll" || args?.layer?.id == "psll") {
return this.preplotLinesTooltip(args);
} else if (args?.layer?.id == "plan") { } else if (args?.layer?.id == "plan") {
return this.plannedLinesTooltip(args); return this.plannedLinesTooltip(args);
} else if (args?.layer?.id == "seqrl" || args?.layer?.id == "seqfl") { } else if (args?.layer?.id == "seqrl" || args?.layer?.id == "seqfl") {
@@ -30,18 +32,49 @@ export default {
}, },
preplotPointsTooltip (args) { preplotPointsTooltip (args) {
const p = args?.object?.properties; const p = args?.object;
const isSailline = args?.layer?.id == "psl";
if (p) { if (p) {
let html = `${isSailline ? "Sail" : "Preplot"} line ${p.line} (${p.incr ? "+" : "-"})`; let html = "Preplot<br/>\n";
if (p.ntba) {
html += ` <b title="Not to be acquired">NTBA</a>`; if ("sailline" in p) {
// If there is a "sailline" attribute, this is actually a source line
// "i" is the source line number, "sailline" the sail line number.
html += `S${String(p.i).padStart(4, "0")}<br/>\n`;
html += `V${String(p.sailline).padStart(4, "0")}<br/>\n`;
} else {
html += `V${String(p.i).padStart(4, "0")}<br/>\n`;
} }
if (p.remarks) { html += `P${String(p.j).padStart(4, "0")}<br/>\n`;
html += `<br/>\n${p.remarks}`;
if (p.sailline_ntba) {
html += `<b>Line <abbr title="Not to be acquired">NTBA</abbr></b><br/>\n`;
} }
const style = { "max-width": "50ex"}; if (p.ntba) {
html += `<b>Point <abbr title="Not to be acquired">NTBA</abbr></b><br/>\n`;
}
return {html, style: this.tooltipDefaultStyle};
}
},
preplotLinesTooltip (args) {
const p = args?.object?.properties;
if (p) {
const lineType = args.layer.id == "psll" ? "Sailline" : "Source line";
const direction = p.incr ? "▲" : "▼";
let html = "";
html += `L${String(p.line).padStart(4, "0")} ${direction}<br/>\n`;
html += `${lineType}<br/>\n`;
if (p.ntba) {
html += "<b>Not to be acquired (NTBA)</b><br/>\n";
}
if (p.remarks) {
html += `<hr/>\n${this.$root.markdown(p.remarks)}\n`;
}
return {html, style: this.tooltipDefaultStyle}; return {html, style: this.tooltipDefaultStyle};
} }