fix(tgu-ops-ui): fix track antimeridian wrap and polygon culling on 2D map

drawTracks: detect antimeridian crossing by comparing consecutive screen X
positions against worldSize/2; use moveTo instead of lineTo on large jumps
so tracks don't draw a horizontal line across the globe.

Tgu2DMapView: replace the heuristic lon-range check (> 300°) with an exact
condition — skip bbox culling when the canvas is wider than the world tile
(entire globe visible) or when topLeft.lon >= bottomRight.lon (viewport
straddles the antimeridian). Both cases previously produced a nonsensical
bbox that hid polygons near ±180°.

drawRequests: remove per-polygon screen-space culling; viewport filtering is
already handled upstream by visiblePolygons, so the redundant check was
incorrectly hiding requests at high zoom levels near canvas edges.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Дмитрий Соловьев
2026-05-31 16:08:20 +03:00
parent 4ab765b0ee
commit 6d1b8e7cde
3 changed files with 14 additions and 13 deletions
@@ -12,15 +12,12 @@ export function drawRequests(
ctx: CanvasRenderingContext2D,
polygons: MapPolygon[],
projection: MapProjection,
viewport: { width: number; height: number }
_viewport: { width: number; height: number }
) {
ctx.save();
for (const polygon of polygons) {
if (polygon.points.length < 3) continue;
const screenPoints = polygon.points.map((point) => projection.project(point));
if (!screenPoints.some((point) => point.x >= -32 && point.x <= viewport.width + 32 && point.y >= -32 && point.y <= viewport.height + 32)) {
continue;
}
const color = SURVEY_COLORS[polygon.surveyType ?? ""] ?? DEFAULT_COLOR;
ctx.beginPath();