From 6d4c9f6b18e6dcd0da1c553d9f5ef5ee03a69278 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sat, 14 Dec 2024 15:12:38 +0100 Subject: [PATCH] fix: sumap - clip routes by bbox --- index.html | 2 +- modules/resample.js | 6 ++++-- versioning.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 6ab76c10..ad5dd028 100644 --- a/index.html +++ b/index.html @@ -8082,7 +8082,7 @@ - + diff --git a/modules/resample.js b/modules/resample.js index 81ffcc1f..21349b9e 100644 --- a/modules/resample.js +++ b/modules/resample.js @@ -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); diff --git a/versioning.js b/versioning.js index e303b891..4435271e 100644 --- a/versioning.js +++ b/versioning.js @@ -13,7 +13,7 @@ * Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2 */ -const VERSION = "1.106.3"; +const VERSION = "1.106.4"; if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function"); {