设置在高德API setFitView方法导致的中心点和缩放与初始化不一致的问题的问题调优
This commit is contained in:
@@ -183,13 +183,6 @@ export default {
|
|||||||
this.timer && clearInterval(this.timer)
|
this.timer && clearInterval(this.timer)
|
||||||
if (AMap && map) {
|
if (AMap && map) {
|
||||||
map.clearMap()
|
map.clearMap()
|
||||||
const center = map.getCenter()
|
|
||||||
const zoom = map.getZoom()
|
|
||||||
map.on('click', () => {
|
|
||||||
map.setZoomAndCenter(zoom, center)
|
|
||||||
map.setPitch(0)
|
|
||||||
this.mapDialog = false
|
|
||||||
})
|
|
||||||
const markers = Array.isArray(this.values) ? this.values : this.values.markers
|
const markers = Array.isArray(this.values) ? this.values : this.values.markers
|
||||||
const polylines = Array.isArray(this.values) ? [] : this.values.polylines || []
|
const polylines = Array.isArray(this.values) ? [] : this.values.polylines || []
|
||||||
markers.map(e => ({lng: e['经度'], lat: e['纬度'], label: e['地区名称'], ...e})).filter(e => e.lng).map((e) => {
|
markers.map(e => ({lng: e['经度'], lat: e['纬度'], label: e['地区名称'], ...e})).filter(e => e.lng).map((e) => {
|
||||||
@@ -214,6 +207,13 @@ export default {
|
|||||||
map, strokeColor: "#00FFAE", ...e, path: e.path.map(p => new AMap.LngLat(p[1], p[0]))
|
map, strokeColor: "#00FFAE", ...e, path: e.path.map(p => new AMap.LngLat(p[1], p[0]))
|
||||||
}))
|
}))
|
||||||
map.setFitView()
|
map.setFitView()
|
||||||
|
const center = map.getCenter()
|
||||||
|
const zoom = map.getZoom()
|
||||||
|
map.on('click', () => {
|
||||||
|
map.setZoomAndCenter(zoom, center)
|
||||||
|
map.setPitch(0)
|
||||||
|
this.mapDialog = false
|
||||||
|
})
|
||||||
this.data.is3d > 0 && map.setPitch(65)
|
this.data.is3d > 0 && map.setPitch(65)
|
||||||
if (this.data.is3dAround == 1) {
|
if (this.data.is3dAround == 1) {
|
||||||
this.timer = setInterval(() => map.setRotation(360, false, 16000))
|
this.timer = setInterval(() => map.setRotation(360, false, 16000))
|
||||||
|
|||||||
Reference in New Issue
Block a user