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:
parent
4ced2c3226
commit
04aacdc431
@ -61,6 +61,8 @@ export module ClientConfig {
|
||||
export class MapConfig {
|
||||
@ConfigProperty()
|
||||
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()
|
||||
useImageMarkers: boolean = true;
|
||||
@ConfigProperty({type: MapProviders})
|
||||
|
@ -5,6 +5,7 @@ import {GalleryMapLightboxComponent} from './lightbox/lightbox.map.gallery.compo
|
||||
import {FileDTO} from '../../../../../common/entities/FileDTO';
|
||||
import {MapService} from './map.service';
|
||||
import {MapComponent} from '@yaga/leaflet-ng2';
|
||||
import {Config} from '../../../../../common/config/public/Config';
|
||||
|
||||
@Component({
|
||||
selector: 'app-gallery-map',
|
||||
@ -51,14 +52,14 @@ export class GalleryMapComponent implements OnChanges, IRenderable, AfterViewIni
|
||||
this.mapPhotos = this.photos.filter(p => {
|
||||
return p.metadata && p.metadata.positionData && p.metadata.positionData.GPSData &&
|
||||
p.metadata.positionData.GPSData.latitude && p.metadata.positionData.GPSData.longitude;
|
||||
}).map(p => {
|
||||
}).slice(0, Config.Client.Map.maxPreviewMarkers).map(p => {
|
||||
return {
|
||||
lat: p.metadata.positionData.GPSData.latitude,
|
||||
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.fitBounds(this.mapPhotos.map(mp => <[number, number]>[mp.lat, mp.lng]));
|
||||
this.yagaMap.zoom = 0;
|
||||
|
@ -221,8 +221,9 @@ export class GallerySearchFieldComponent implements ControlValueAccessor, Valida
|
||||
|
||||
if (this.rawSearchText.trim().length > 0) { // are we searching for anything?
|
||||
try {
|
||||
if (this.autoCompleteItems) {
|
||||
this.autoCompleteItems.unsubscribe();
|
||||
if (this.autoCompleteItemsSubscription) {
|
||||
this.autoCompleteItemsSubscription.unsubscribe();
|
||||
this.autoCompleteItemsSubscription = null;
|
||||
}
|
||||
this.autoCompleteItems = this._autoCompleteService.autoComplete(searchText);
|
||||
this.autoCompleteItemsSubscription = this.autoCompleteItems.subscribe(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user