1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Reducing max markers in map preview

This commit is contained in:
Patrik J. Braun 2021-04-06 13:15:50 +02:00
parent 4ced2c3226
commit 04aacdc431
3 changed files with 8 additions and 4 deletions

View File

@ -61,6 +61,8 @@ export module ClientConfig {
export class MapConfig { export class MapConfig {
@ConfigProperty() @ConfigProperty()
enabled: boolean = true; enabled: boolean = true;
@ConfigProperty({type: 'unsignedInt', description: 'Maximum number of markers to be shown on the map preview on the gallery page.'})
maxPreviewMarkers: number = 50;
@ConfigProperty() @ConfigProperty()
useImageMarkers: boolean = true; useImageMarkers: boolean = true;
@ConfigProperty({type: MapProviders}) @ConfigProperty({type: MapProviders})

View File

@ -5,6 +5,7 @@ import {GalleryMapLightboxComponent} from './lightbox/lightbox.map.gallery.compo
import {FileDTO} from '../../../../../common/entities/FileDTO'; import {FileDTO} from '../../../../../common/entities/FileDTO';
import {MapService} from './map.service'; import {MapService} from './map.service';
import {MapComponent} from '@yaga/leaflet-ng2'; import {MapComponent} from '@yaga/leaflet-ng2';
import {Config} from '../../../../../common/config/public/Config';
@Component({ @Component({
selector: 'app-gallery-map', selector: 'app-gallery-map',
@ -51,14 +52,14 @@ export class GalleryMapComponent implements OnChanges, IRenderable, AfterViewIni
this.mapPhotos = this.photos.filter(p => { this.mapPhotos = this.photos.filter(p => {
return p.metadata && p.metadata.positionData && p.metadata.positionData.GPSData && return p.metadata && p.metadata.positionData && p.metadata.positionData.GPSData &&
p.metadata.positionData.GPSData.latitude && p.metadata.positionData.GPSData.longitude; p.metadata.positionData.GPSData.latitude && p.metadata.positionData.GPSData.longitude;
}).map(p => { }).slice(0, Config.Client.Map.maxPreviewMarkers).map(p => {
return { return {
lat: p.metadata.positionData.GPSData.latitude, lat: p.metadata.positionData.GPSData.latitude,
lng: p.metadata.positionData.GPSData.longitude lng: p.metadata.positionData.GPSData.longitude
}; };
}); });
if (this.yagaMap) { if (this.yagaMap && this.mapPhotos.length > 0) {
this.yagaMap.setView(this.mapPhotos[0], 99); this.yagaMap.setView(this.mapPhotos[0], 99);
this.yagaMap.fitBounds(this.mapPhotos.map(mp => <[number, number]>[mp.lat, mp.lng])); this.yagaMap.fitBounds(this.mapPhotos.map(mp => <[number, number]>[mp.lat, mp.lng]));
this.yagaMap.zoom = 0; this.yagaMap.zoom = 0;

View File

@ -221,8 +221,9 @@ export class GallerySearchFieldComponent implements ControlValueAccessor, Valida
if (this.rawSearchText.trim().length > 0) { // are we searching for anything? if (this.rawSearchText.trim().length > 0) { // are we searching for anything?
try { try {
if (this.autoCompleteItems) { if (this.autoCompleteItemsSubscription) {
this.autoCompleteItems.unsubscribe(); this.autoCompleteItemsSubscription.unsubscribe();
this.autoCompleteItemsSubscription = null;
} }
this.autoCompleteItems = this._autoCompleteService.autoComplete(searchText); this.autoCompleteItems = this._autoCompleteService.autoComplete(searchText);
this.autoCompleteItemsSubscription = this.autoCompleteItems.subscribe(() => { this.autoCompleteItemsSubscription = this.autoCompleteItems.subscribe(() => {