小车动画跟随 + 速度弹窗
This commit is contained in:
parent
eae6eda526
commit
6ea549fde2
@ -13,7 +13,8 @@ export function playAnimation(map,data,line){
|
|||||||
if(!data.infoWindow){
|
if(!data.infoWindow){
|
||||||
data.infoWindow = new AMap.InfoWindow({
|
data.infoWindow = new AMap.InfoWindow({
|
||||||
offset: new AMap.Pixel(6, -25),
|
offset: new AMap.Pixel(6, -25),
|
||||||
content: ""
|
content: "",
|
||||||
|
isCustom: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ export function playAnimation(map,data,line){
|
|||||||
let lastLocation = e.passedPath[e.passedPath.length - 1];
|
let lastLocation = e.passedPath[e.passedPath.length - 1];
|
||||||
data.infoWindow.setPosition(lastLocation);
|
data.infoWindow.setPosition(lastLocation);
|
||||||
let speed = ((line[e.index].speed||0) * 3.6).toFixed(2)
|
let speed = ((line[e.index].speed||0) * 3.6).toFixed(2)
|
||||||
data.infoWindow.setContent(`${speed} km/h`);
|
data.infoWindow.setContent(`<div style="width:100px;background: #fff;border-radius: 5px">${speed} km/h</div>`);
|
||||||
map.setCenter(e.target.getPosition(),true)
|
map.setCenter(e.target.getPosition(),true)
|
||||||
})
|
})
|
||||||
data.animateMarker.on("moveend",()=>{
|
data.animateMarker.on("moveend",()=>{
|
||||||
|
Loading…
Reference in New Issue
Block a user