Own subsea cables land on the city's dot, nudged cities too (#305)

An own cable's map line came straight from its surveyed lon/lat path, so it
ended at the city's exact coordinates, while the city itself is drawn with its
display nudge (CITY_NUDGE). Fujairah's [1,2] left every own cable there 2 px
above the dot; Dubai, Karachi, Barcelona and Osaka are off by more. The ends of
the map line now sit on the drawn city, as commercial cables already do; the
saved path and its length are unchanged.
This commit is contained in:
Frederic Jung 2026-11-06 01:50:40 +00:00
parent dd6e4f4f8a
commit 7f3b742451
No known key found for this signature in database
5 changed files with 35 additions and 3 deletions

View file

@ -155,7 +155,9 @@ function seaReady(a,b){seaSync();const key=seaKey(a,b);
}catch(e){SEA_SURVEY.failed=true;if(SEA_SURVEY.worker)SEA_SURVEY.worker.terminate();SEA_SURVEY.worker=null;SEA_SURVEY.pending.clear();return true;}
}
const seaSurveyAttr=(a,b)=>{seaSync();const k=seaKey(a,b);return SEA_SURVEY.pending.has(k)?`data-sea-survey="${k}"`:'';};
function seaMapPoints(pts){const out=[];for(const p of pts){const q=proj(...p);if(out.length)q[0]+=W*Math.round((out[out.length-1][0]-q[0])/W);out.push(q);}return out;}
// The ends sit on the cities' dots, which the map may nudge off their exact lon/lat (#305).
function seaMapPoints(pts,a,b){const out=[];for(const p of pts){const q=proj(...p);if(out.length)q[0]+=W*Math.round((out[out.length-1][0]-q[0])/W);out.push(q);}
const n=out.length,end=(i,c)=>{if(c)out[i]=[c.x+W*Math.round((out[i][0]-c.x)/W),c.y];};if(n>1){end(0,CITY[a]);end(n-1,CITY[b]);}return out;}
// Designs pay for progressively tighter surveys; all use a feasible marine path.
const SEA_DESIGNS={standard:{n:N_('common.standard'),cost:1,time:1},optimized:{n:N_('common.optimized'),cost:3,time:1.3},express:{n:N_('common.low_latency'),cost:7,time:1.7}};