自定义marker后,会因为地图默认使用3d的造成实际位置偏移。
越缩放越明显,需要offset处理下。
常用在自定义图标和替换当前位置上。

let marker = new AMap.Marker({
offset:new AMap.Pixel(-10,-14),// 图大小决定类似 tranformcss 一半
title: item.name,
position: item.arr,//位置
icon: new AMap.Icon({
image: "xx.png",
size: new AMap.Size(20, 26.5),
imageSize: new AMap.Size(20, 26.5)//图标大小
})
})
网友评论