map如何获移动地图后的中心点并设置中心点?
移动时获取中心经纬度–>设置中心点经纬度。但是我getCenterLocation获取到的总是中心点定位,而不是移动后的中心点定位
regionchangeF: function (e) { let that=this; if (e.type == 'end' && (e.causedBy == 'scale' || e.causedBy == 'drag')) { this.mapCtx.getCenterLocation({
console.log("移动后获取到的精度"+res.longitude) console.log("移动后获取到的纬度"+res.latitude) that.mapCtx.moveToLocation() } }) }else{ console.log("...") } } |
wxml
<map id='myMap' markers="{{markers}}" longitude="{{longitude}}" latitude="{{latitude}}" enable-zoom="{{enablezoom}}" enable-scroll="{{enablescroll}}" show-location=true bindregionchange="regionchangeF"></map> |
