realize fitBounds add new property useDefaultZoom
This commit is contained in:
parent
51bec36d0d
commit
eafbc427d8
@ -421,8 +421,8 @@ export default class TbGoogleMap {
|
||||
|
||||
|
||||
/* eslint-disable no-undef */
|
||||
fitBounds(bounds) {
|
||||
if (this.dontFitMapBounds && this.defaultZoomLevel) {
|
||||
fitBounds(bounds, useDefaultZoom) {
|
||||
if ((this.dontFitMapBounds || useDefaultZoom) && this.defaultZoomLevel) {
|
||||
this.map.setZoom(this.defaultZoomLevel);
|
||||
this.map.setCenter(bounds.getCenter());
|
||||
} else {
|
||||
|
||||
@ -732,7 +732,7 @@ export default class TbMapWidgetV2 {
|
||||
}
|
||||
});
|
||||
|
||||
tbMap.map.fitBounds(bounds);
|
||||
tbMap.map.fitBounds(bounds, tbMap.isEdit && tbMap.markers.length === 1);
|
||||
}
|
||||
|
||||
function mapPolygonArray (rawArray) {
|
||||
@ -781,7 +781,7 @@ export default class TbMapWidgetV2 {
|
||||
return !(!ds[tbMap.locationSettings.latKeyName] && !ds[tbMap.locationSettings.lngKeyName]);
|
||||
});
|
||||
tbMap.initBounds = !dataValid;
|
||||
tbMap.map.fitBounds(bounds);
|
||||
tbMap.map.fitBounds(bounds, tbMap.isEdit && tbMap.markers.length === 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -845,7 +845,7 @@ export default class TbMapWidgetV2 {
|
||||
})
|
||||
}
|
||||
}
|
||||
map.fitBounds(bounds);
|
||||
map.fitBounds(bounds, map.isEdit && map.markers.length === 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,9 +273,9 @@ export default class TbOpenStreetMap {
|
||||
polygon.redraw();
|
||||
}
|
||||
|
||||
fitBounds(bounds) {
|
||||
fitBounds(bounds, useDefaultZoom) {
|
||||
if (bounds.isValid()) {
|
||||
if (this.dontFitMapBounds && this.defaultZoomLevel) {
|
||||
if ((this.dontFitMapBounds || useDefaultZoom) && this.defaultZoomLevel) {
|
||||
this.map.setZoom(this.defaultZoomLevel, {animate: false});
|
||||
this.map.panTo(bounds.getCenter(), {animate: false});
|
||||
} else {
|
||||
|
||||
@ -58,7 +58,7 @@ export default class TbTencentMap {
|
||||
|
||||
|
||||
if (initCallback) {
|
||||
initCallback();
|
||||
setTimeout(initCallback, 0);// eslint-disable-line
|
||||
}
|
||||
}
|
||||
|
||||
@ -427,8 +427,8 @@ export default class TbTencentMap {
|
||||
}
|
||||
|
||||
/* eslint-disable no-undef ,no-unused-vars*/
|
||||
fitBounds(bounds) {
|
||||
if (this.dontFitMapBounds && this.defaultZoomLevel) {
|
||||
fitBounds(bounds, useDefaultZoom) {
|
||||
if ((this.dontFitMapBounds || useDefaultZoom) && this.defaultZoomLevel) {
|
||||
this.map.setZoom(this.defaultZoomLevel);
|
||||
this.map.setCenter(bounds.getCenter());
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user