mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-01-24 05:17:16 +02:00
parent
f01766ba49
commit
9dbc196c27
@ -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})
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user