Merge pull request #3722 from vvlladd28/bug/map/fit-bound
Fixed fit bounds marker is disabled covered all markers
This commit is contained in:
commit
c1737d0de3
@ -487,7 +487,8 @@ export default abstract class LeafletMap {
|
||||
}
|
||||
|
||||
const mapBounds = this.map.getBounds();
|
||||
if (bounds.isValid() && (!this.bounds || !this.bounds.isValid() || !this.bounds.equals(bounds) && !mapBounds.contains(bounds))) {
|
||||
if (bounds.isValid() && (!this.bounds || !this.bounds.isValid() || !this.bounds.equals(bounds)
|
||||
&& this.options.fitMapBounds ? !mapBounds.contains(bounds) : false)) {
|
||||
this.bounds = bounds;
|
||||
this.fitBounds(bounds);
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ import { EntityType } from '@shared/models/entity-type.models';
|
||||
import tinycolor from 'tinycolor2';
|
||||
|
||||
export const DEFAULT_MAP_PAGE_SIZE = 16384;
|
||||
export const DEFAULT_ZOOM_LEVEL = 8;
|
||||
|
||||
export type GenericFunction = (data: FormattedData, dsData: FormattedData[], dsIndex: number) => string;
|
||||
export type MarkerImageFunction = (data: FormattedData, dsData: FormattedData[], dsIndex: number) => string;
|
||||
@ -229,7 +230,6 @@ export const defaultSettings: any = {
|
||||
strokeWeight: 2,
|
||||
strokeOpacity: 1.0,
|
||||
initCallback: () => { },
|
||||
defaultZoomLevel: 8,
|
||||
disableScrollZooming: false,
|
||||
minZoomLevel: 16,
|
||||
credentials: '',
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
import L from 'leaflet';
|
||||
import LeafletMap from '../leaflet-map';
|
||||
import { UnitedMapSettings } from '../map-models';
|
||||
import { DEFAULT_ZOOM_LEVEL, UnitedMapSettings } from '../map-models';
|
||||
import 'leaflet.gridlayer.googlemutant';
|
||||
import { ResourcesService } from '@core/services/resources.service';
|
||||
import { WidgetContext } from '@home/models/widget-component.models';
|
||||
@ -39,7 +39,7 @@ export class GoogleMap extends LeafletMap {
|
||||
const map = L.map($container, {
|
||||
attributionControl: false,
|
||||
editable: !!options.editablePolygon
|
||||
}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel);
|
||||
}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel || DEFAULT_ZOOM_LEVEL);
|
||||
(L.gridLayer as any).googleMutant({
|
||||
type: options?.gmDefaultMapType || 'roadmap'
|
||||
}).addTo(map);
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
import L from 'leaflet';
|
||||
import LeafletMap from '../leaflet-map';
|
||||
import { UnitedMapSettings } from '../map-models';
|
||||
import { DEFAULT_ZOOM_LEVEL, UnitedMapSettings } from '../map-models';
|
||||
import { WidgetContext } from '@home/models/widget-component.models';
|
||||
|
||||
export class HEREMap extends LeafletMap {
|
||||
@ -24,7 +24,7 @@ export class HEREMap extends LeafletMap {
|
||||
super(ctx, $container, options);
|
||||
const map = L.map($container, {
|
||||
editable: !!options.editablePolygon
|
||||
}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel);
|
||||
}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel || DEFAULT_ZOOM_LEVEL);
|
||||
const tileLayer = (L.tileLayer as any).provider(options.mapProviderHere || 'HERE.normalDay', options.credentials);
|
||||
tileLayer.addTo(map);
|
||||
super.initSettings(options);
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
import L from 'leaflet';
|
||||
import LeafletMap from '../leaflet-map';
|
||||
import { UnitedMapSettings } from '../map-models';
|
||||
import { DEFAULT_ZOOM_LEVEL, UnitedMapSettings } from '../map-models';
|
||||
import { WidgetContext } from '@home/models/widget-component.models';
|
||||
|
||||
export class OpenStreetMap extends LeafletMap {
|
||||
@ -24,7 +24,7 @@ export class OpenStreetMap extends LeafletMap {
|
||||
super(ctx, $container, options);
|
||||
const map = L.map($container, {
|
||||
editable: !!options.editablePolygon
|
||||
}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel);
|
||||
}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel || DEFAULT_ZOOM_LEVEL);
|
||||
let tileLayer;
|
||||
if (options.useCustomProvider) {
|
||||
tileLayer = L.tileLayer(options.customProviderTileUrl);
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
import L from 'leaflet';
|
||||
import LeafletMap from '../leaflet-map';
|
||||
import { UnitedMapSettings } from '../map-models';
|
||||
import { DEFAULT_ZOOM_LEVEL, UnitedMapSettings } from '../map-models';
|
||||
import { WidgetContext } from '@home/models/widget-component.models';
|
||||
|
||||
export class TencentMap extends LeafletMap {
|
||||
@ -26,7 +26,7 @@ export class TencentMap extends LeafletMap {
|
||||
const txUrl = 'http://rt{s}.map.gtimg.com/realtimerender?z={z}&x={x}&y={y}&type=vector&style=0';
|
||||
const map = L.map($container, {
|
||||
editable: !!options.editablePolygon
|
||||
}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel);
|
||||
}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel || DEFAULT_ZOOM_LEVEL);
|
||||
const txLayer = L.tileLayer(txUrl, {
|
||||
subdomains: '0123',
|
||||
tms: true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user