mirror of
https://github.com/n30nex/CartoLite-Server.git
synced 2026-10-16 03:00:27 +00:00
Keep visible route endpoints across wrapped longitude views
This commit is contained in:
@@ -9,6 +9,7 @@ describe('historical route WebGL geometry', () => {
|
||||
expect(routeMayIntersectView([-179, 40], [-177, 41], [175, 39, 185, 42])).toBe(true);
|
||||
expect(routeMayIntersectView([179, 40], [180, 41], [-185, 39, -175, 42])).toBe(true);
|
||||
expect(routeMayIntersectView([0, 40], [1, 41], [175, 39, -175, 42])).toBe(false);
|
||||
expect(routeMayIntersectView([10, 40], [-169, 40], [170, 39, -160, 41])).toBe(true);
|
||||
});
|
||||
it('keeps one exact line segment for every route', () => {
|
||||
const routes: Feature<LineString>[] = [
|
||||
|
||||
@@ -259,7 +259,8 @@ export function routeMayIntersectView(a: Coordinate, b: Coordinate, view: readon
|
||||
const padX = Math.max(0.025, span * 0.15);
|
||||
const padY = Math.max(0.025, (north - south) * 0.15);
|
||||
if (Math.max(a[1], b[1]) < south - padY || Math.min(a[1], b[1]) > north + padY) return false;
|
||||
return span >= 360 || !(Math.max(x1, x2) < west - padX || Math.min(x1, x2) > west + span + padX);
|
||||
return span >= 360 || [-360, 0, 360].some(offset =>
|
||||
!(Math.max(x1, x2) + offset < west - padX || Math.min(x1, x2) + offset > west + span + padX));
|
||||
}
|
||||
|
||||
function strokeVertices(segments: readonly StrokeSegment[], origin: [number, number, number] = [0, 0, 0]): Float32Array {
|
||||
|
||||
Reference in New Issue
Block a user