fix: sumap - clip routes by bbox

This commit is contained in:
Azgaar 2024-12-14 15:12:38 +01:00
parent 488f51a0f4
commit 6d4c9f6b18
3 changed files with 6 additions and 4 deletions

View file

@ -254,9 +254,11 @@ window.Resample = (function () {
});
if (points.length < 2) return null;
const firstCell = points[0][2];
const bbox = [0, 0, graphWidth, graphHeight];
const clipped = lineclip(points, bbox)[0].map(([x, y]) => [rn(x, 2), rn(y, 2), findCell(x, y)]);
const firstCell = clipped[0][2];
const feature = pack.cells.f[firstCell];
return {...route, feature, points};
return {...route, feature, points: clipped};
})
.filter(Boolean);