Commit c1737d0de37bbc80e8dc352d1c6f9070c8a5d47e

Authored by Igor Kulikov
Committed by GitHub
2 parents f0ed4329 34c8294e

Merge pull request #3722 from vvlladd28/bug/map/fit-bound

Fixed fit bounds marker is disabled covered all markers
... ... @@ -487,7 +487,8 @@ export default abstract class LeafletMap {
487 487 }
488 488
489 489 const mapBounds = this.map.getBounds();
490   - if (bounds.isValid() && (!this.bounds || !this.bounds.isValid() || !this.bounds.equals(bounds) && !mapBounds.contains(bounds))) {
  490 + if (bounds.isValid() && (!this.bounds || !this.bounds.isValid() || !this.bounds.equals(bounds)
  491 + && this.options.fitMapBounds ? !mapBounds.contains(bounds) : false)) {
491 492 this.bounds = bounds;
492 493 this.fitBounds(bounds);
493 494 }
... ...
... ... @@ -20,6 +20,7 @@ import { EntityType } from '@shared/models/entity-type.models';
20 20 import tinycolor from 'tinycolor2';
21 21
22 22 export const DEFAULT_MAP_PAGE_SIZE = 16384;
  23 +export const DEFAULT_ZOOM_LEVEL = 8;
23 24
24 25 export type GenericFunction = (data: FormattedData, dsData: FormattedData[], dsIndex: number) => string;
25 26 export type MarkerImageFunction = (data: FormattedData, dsData: FormattedData[], dsIndex: number) => string;
... ... @@ -229,7 +230,6 @@ export const defaultSettings: any = {
229 230 strokeWeight: 2,
230 231 strokeOpacity: 1.0,
231 232 initCallback: () => { },
232   - defaultZoomLevel: 8,
233 233 disableScrollZooming: false,
234 234 minZoomLevel: 16,
235 235 credentials: '',
... ...
... ... @@ -17,7 +17,7 @@
17 17
18 18 import L from 'leaflet';
19 19 import LeafletMap from '../leaflet-map';
20   -import { UnitedMapSettings } from '../map-models';
  20 +import { DEFAULT_ZOOM_LEVEL, UnitedMapSettings } from '../map-models';
21 21 import 'leaflet.gridlayer.googlemutant';
22 22 import { ResourcesService } from '@core/services/resources.service';
23 23 import { WidgetContext } from '@home/models/widget-component.models';
... ... @@ -39,7 +39,7 @@ export class GoogleMap extends LeafletMap {
39 39 const map = L.map($container, {
40 40 attributionControl: false,
41 41 editable: !!options.editablePolygon
42   - }).setView(options?.defaultCenterPosition, options?.defaultZoomLevel);
  42 + }).setView(options?.defaultCenterPosition, options?.defaultZoomLevel || DEFAULT_ZOOM_LEVEL);
43 43 (L.gridLayer as any).googleMutant({
44 44 type: options?.gmDefaultMapType || 'roadmap'
45 45 }).addTo(map);
... ...
... ... @@ -16,7 +16,7 @@
16 16
17 17 import L from 'leaflet';
18 18 import LeafletMap from '../leaflet-map';
19   -import { UnitedMapSettings } from '../map-models';
  19 +import { DEFAULT_ZOOM_LEVEL, UnitedMapSettings } from '../map-models';
20 20 import { WidgetContext } from '@home/models/widget-component.models';
21 21
22 22 export class HEREMap extends LeafletMap {
... ... @@ -24,7 +24,7 @@ export class HEREMap extends LeafletMap {
24 24 super(ctx, $container, options);
25 25 const map = L.map($container, {
26 26 editable: !!options.editablePolygon
27   - }).setView(options?.defaultCenterPosition, options?.defaultZoomLevel);
  27 + }).setView(options?.defaultCenterPosition, options?.defaultZoomLevel || DEFAULT_ZOOM_LEVEL);
28 28 const tileLayer = (L.tileLayer as any).provider(options.mapProviderHere || 'HERE.normalDay', options.credentials);
29 29 tileLayer.addTo(map);
30 30 super.initSettings(options);
... ...
... ... @@ -16,7 +16,7 @@
16 16
17 17 import L from 'leaflet';
18 18 import LeafletMap from '../leaflet-map';
19   -import { UnitedMapSettings } from '../map-models';
  19 +import { DEFAULT_ZOOM_LEVEL, UnitedMapSettings } from '../map-models';
20 20 import { WidgetContext } from '@home/models/widget-component.models';
21 21
22 22 export class OpenStreetMap extends LeafletMap {
... ... @@ -24,7 +24,7 @@ export class OpenStreetMap extends LeafletMap {
24 24 super(ctx, $container, options);
25 25 const map = L.map($container, {
26 26 editable: !!options.editablePolygon
27   - }).setView(options?.defaultCenterPosition, options?.defaultZoomLevel);
  27 + }).setView(options?.defaultCenterPosition, options?.defaultZoomLevel || DEFAULT_ZOOM_LEVEL);
28 28 let tileLayer;
29 29 if (options.useCustomProvider) {
30 30 tileLayer = L.tileLayer(options.customProviderTileUrl);
... ...
... ... @@ -17,7 +17,7 @@
17 17
18 18 import L from 'leaflet';
19 19 import LeafletMap from '../leaflet-map';
20   -import { UnitedMapSettings } from '../map-models';
  20 +import { DEFAULT_ZOOM_LEVEL, UnitedMapSettings } from '../map-models';
21 21 import { WidgetContext } from '@home/models/widget-component.models';
22 22
23 23 export class TencentMap extends LeafletMap {
... ... @@ -26,7 +26,7 @@ export class TencentMap extends LeafletMap {
26 26 const txUrl = 'http://rt{s}.map.gtimg.com/realtimerender?z={z}&x={x}&y={y}&type=vector&style=0';
27 27 const map = L.map($container, {
28 28 editable: !!options.editablePolygon
29   - }).setView(options?.defaultCenterPosition, options?.defaultZoomLevel);
  29 + }).setView(options?.defaultCenterPosition, options?.defaultZoomLevel || DEFAULT_ZOOM_LEVEL);
30 30 const txLayer = L.tileLayer(txUrl, {
31 31 subdomains: '0123',
32 32 tms: true,
... ...