Commit d7d8953c by zhangxw

轨迹回放真机bug

1 parent 073faa0e
...@@ -170,6 +170,20 @@ Page({ ...@@ -170,6 +170,20 @@ Page({
polyline: polyline, polyline: polyline,
includePoints: arr includePoints: arr
}) })
this.myMap.getMapCtx().removeMarkers({
markerIds: [1]
})
let marker = [{
id: 1,
width: 15,
height: 25,
latitude: this.data.polyline[0].points[0].latitude,
longitude: this.data.polyline[0].points[0].longitude,
iconPath: '../../images/car.png'
}]
this.myMap.getMapCtx().addMarkers({
markers: marker
})
} else { } else {
wx.showModal({ wx.showModal({
content: '暂无数据', content: '暂无数据',
...@@ -194,36 +208,20 @@ Page({ ...@@ -194,36 +208,20 @@ Page({
}, },
beginTrack() { beginTrack() {
if (this.data.polyline.length) { if (this.data.polyline.length) {
this.myMap.getMapCtx().removeMarkers({ this.setData({
markerIds: [1] isReplayIng: true
}) })
let marker = [{ this.myMap.getMapCtx().moveAlong({
id: 1, markerId: 1,
width: 15, path: this.data.polyline[0].points,
height: 25, duration: this.data.duration,
latitude: this.data.polyline[0].points[0].latitude, success: (res) => {
longitude: this.data.polyline[0].points[0].longitude,
iconPath: '../../images/car.png'
}]
this.myMap.getMapCtx().addMarkers({
markers: marker,
success: () => {
this.setData({ this.setData({
isReplayIng: true isReplayIng: false
})
this.myMap.getMapCtx().moveAlong({
markerId: 1,
path: this.data.polyline[0].points,
duration: this.data.duration,
success: (res) => {
this.setData({
isReplayIng: false
})
},
fail: () => {
this.beginTrack()
}
}) })
},
fail: () => {
this.beginTrack()
} }
}) })
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!