Skip to content

Commit 350a5da

Browse files
committed
also let msg.payload.flag set flag on SIDC
if not otherwise specified
1 parent 5e11eb4 commit 350a5da

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

worldmap/worldmap.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,10 +2129,19 @@ function setMarker(data) {
21292129
opts.staffComments = emojify(":flag-"+cc+":") + " " + (opts?.staffComments || "");
21302130
data.flag = opts.country.toUpperCase() + " " + emojify(":flag-"+cc+":");
21312131
}
2132-
if (data.SIDC.length == 20 && opts?.country && opts.country.length == 2) {
2133-
data.flag = opts.country.toUpperCase() + " " + emojify(":flag-"+opts.country.toLowerCase()+":");
2134-
opts.country = data.flag;
2132+
if (data.SIDC.length == 12 && data?.flag && data.flag.length == 2) {
2133+
opts.staffComments = emojify(":flag-"+data.flag.toLowerCase()+":") + " " + (opts?.staffComments || "");
21352134
}
2135+
if (data.SIDC.length == 20) {
2136+
if (opts?.country && opts.country.length == 2) {
2137+
data.flag = opts.country.toUpperCase() + " " + emojify(":flag-"+opts.country.toLowerCase()+":");
2138+
opts.country = data.flag;
2139+
}
2140+
else if (data?.flag && data.flag.length == 2) {
2141+
opts.country = data.flag.toUpperCase() + " " + emojify(":flag-"+data.flag.toLowerCase()+":");
2142+
}
2143+
}
2144+
console.log("OPTS",opts)
21362145
data.speed = opts?.speed || data?.speed; // If SIDC then options.speed can override the speed.
21372146
if (data?.speed && !opts?.direction) { opts.direction = data?.track || data?.hdg || data?.heading || data?.COG || data?.bearing }
21382147
if (data.speed == undefined) { delete data.speed; }

0 commit comments

Comments
 (0)