代码片段: https://developers.weixin.qq.com/s/njohFhmW7xEl
核心代码
this.mapCtx = wx.createMapContext('myMap')
console.log('this.mapCtx')
const marker1 = {
id: 1,
latitude: 40.04975,
longitude: 116.28526,
width: 20,
height: 30,
name: 'marker1'
}
const targetMarkerLngLat = [[116.31633, 40.05944], [116.28643, 40.06416], [116.27044, 40.05795], [116.26855, 40.04716], [116.27976, 40.03818], [116.29841, 40.03945], [116.31486, 40.04656]]
for (let i = 0; i < targetMarkerLngLat.length - 1; i ++) {
const lngLatArr = targetMarkerLngLat[i]
const lngLat = {
longitude: lngLatArr[0],
latitude: lngLatArr[1]
}
this.mapCtx.addArc({
id: i,
start: { latitude: marker1.latitude, longitude: marker1.longitude },
end: { latitude: lngLat.latitude, longitude: lngLat.longitude },
angle: 30,
color: '#ff0000',
success: () => {},
complete: (e) => {
console.log("complete", e)
}
})
}
安卓真机截图:
安卓真机log:回调显示绘制成功,但实际无弧线
ios绘制无异常:
你没有传width