fix: two-pass render - all countries as single white fill first
All checks were successful
Deploy Internet for Kids / Build & Push (push) Successful in 16s
Deploy Internet for Kids / Deploy (push) Successful in 6s
Deploy Internet for Kids / Health Check (push) Successful in 2s
Deploy Internet for Kids / Smoke Tests (push) Successful in 3s
Deploy Internet for Kids / IndexNow Ping (push) Successful in 8s
Deploy Internet for Kids / Promote to Latest (push) Successful in 2s
Deploy Internet for Kids / Rollback (push) Has been skipped
Deploy Internet for Kids / Audit (push) Successful in 2s

Canvas anti-aliasing creates semi-transparent edges between adjacent
polygons. Pass 1 draws ALL countries in one beginPath/fill call as
solid white - no seams possible. Pass 2 overdraws colored countries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-04-04 13:22:11 +03:00
parent 64c71234ec
commit 89c8567dcc

View File

@@ -110,11 +110,27 @@
if (!geoData) return; if (!geoData) return;
// Draw country fills (no separate land fill — gaps show ocean, not white) // Pass 1: draw ALL countries as white in a single path (eliminates inter-polygon seams)
ctx.fillStyle = '#ffffff';
ctx.beginPath();
geoData.features.forEach(function(f) {
var geom = f.geometry;
if (geom.type === 'Polygon') {
geom.coordinates.forEach(function(ring) { traceRing(ctx, ring, sx, sy); });
} else if (geom.type === 'MultiPolygon') {
geom.coordinates.forEach(function(poly) {
poly.forEach(function(ring) { traceRing(ctx, ring, sx, sy); });
});
}
});
ctx.fill('evenodd');
// Pass 2: overdraw colored countries only
geoData.features.forEach(function(f) { geoData.features.forEach(function(f) {
var id = String(f.id).padStart(3, '0'); var id = String(f.id).padStart(3, '0');
var c = byIsoNum[id]; var c = byIsoNum[id];
ctx.fillStyle = c ? STATUS_COLORS[c.status] : '#ffffff'; if (!c) return; // skip no-data (already white)
ctx.fillStyle = STATUS_COLORS[c.status];
drawGeometry(ctx, f.geometry, sx, sy, true); drawGeometry(ctx, f.geometry, sx, sy, true);
}); });