Commit 2ae0bf4bb483a1c67524880e2a9f79d2f062c506

Authored by wangfan
1 parent 577234db

地图优化

Showing 1 changed file with 12 additions and 3 deletions
... ... @@ -201,7 +201,6 @@ Page({
console.log('regionchange.getScale', res, this.data.map.scale)
},
})
this.mapCtx.getCenterLocation({
success:(res)=>{
console.log('regionchange.getCenterLocation',res)
... ... @@ -218,11 +217,21 @@ Page({
console.log('regionchange.getRegion',res)
if(res.southwest.latitude!=this.mapData.region.southwest.latitude) {
this.mapData.region = res
this.getMarkers();
this.timeoutGetMarkers();
}
},
})
},
setTimeoutGetMarkers:'',
timeoutGetMarkers(){//延时获取
if(this.setTimeoutGetMarkers){
clearTimeout(this.setTimeoutGetMarkers);
this.setTimeoutGetMarkers='';
}
this.setTimeoutGetMarkers=setTimeout(()=>{
this.getMarkers();
},1200)
},
mapUpdated(e){
console.log('mapUpdated', e)
this.getClassNameFlag=true;
... ... @@ -351,7 +360,7 @@ Page({
lat: this.user.latitude,
lng: this.user.longitude,
offset: 0,
rows: 10000,
rows: 50,
distance: 100000,
map:JSON.stringify({...this.mapData.region,scale:this.mapData.scale})
}
... ...