diff --git a/src/common/config/public/ClientConfig.ts b/src/common/config/public/ClientConfig.ts index ff4ab6dc..4d1d4de8 100644 --- a/src/common/config/public/ClientConfig.ts +++ b/src/common/config/public/ClientConfig.ts @@ -578,6 +578,15 @@ export class ClientMapConfig { new PathThemeConfig('var(--bs-secondary)') )]) ]; + @ConfigProperty({ + type: 'unsignedInt', + tags: { + name: $localize`Bend long path trigger`, + priority: ConfigPriority.underTheHood + } as TAGS, + description: $localize`Map will bend the path if two points are this far apart on latititude axes. This intended to bend flight if only the end and the start points are given.`, + }) + bendLongPathsTrigger: number = 1; } @SubConfigClass({tags: {client: true}, softReadonly: true}) diff --git a/src/frontend/app/ui/gallery/map/lightbox/lightbox.map.gallery.component.ts b/src/frontend/app/ui/gallery/map/lightbox/lightbox.map.gallery.component.ts index 2a15600f..07774c35 100644 --- a/src/frontend/app/ui/gallery/map/lightbox/lightbox.map.gallery.component.ts +++ b/src/frontend/app/ui/gallery/map/lightbox/lightbox.map.gallery.component.ts @@ -524,14 +524,13 @@ export class GalleryMapLightboxComponent implements OnChanges, OnDestroy { private addArchForLongDistancePaths(parsedGPX: { name: string, path: LatLngLiteral[]; markers: LatLngLiteral[] }) { - const DISTANCE_TRIGGER = 0.5; for (let i = 0; i < parsedGPX.path.length - 1; ++i) { const dst = (a: LatLngLiteral, b: LatLngLiteral) => { return Math.sqrt(Math.pow(a.lat - b.lat, 2) + Math.pow(a.lng - b.lng, 2)); }; - if (Math.abs(parsedGPX.path[i].lng - parsedGPX.path[i + 1].lng) > DISTANCE_TRIGGER) { + if (Math.abs(parsedGPX.path[i].lng - parsedGPX.path[i + 1].lng) > Config.Map.bendLongPathsTrigger) { const s = parsedGPX.path[i]; const e = parsedGPX.path[i + 1]; const k = `${s.lat.toFixed(2)},${s.lng.toFixed(2)},${e.lat.toFixed(2)},${e.lng.toFixed(2)}`; @@ -545,7 +544,7 @@ export class GalleryMapLightboxComponent implements OnChanges, OnDestroy { const d = dst(s, e); //start end distance const newPoints: LatLngLiteral[] = []; - const N = Math.round(d / DISTANCE_TRIGGER); // number of new points + const N = Math.round(d / Config.Map.bendLongPathsTrigger); // number of new points const m: LatLngLiteral = { //mid point lat: (s.lat + e.lat) / 2, lng: (s.lng + e.lng) / 2,