天地图——自定义标注marker在地图放大缩小偏移问题

  1. 自定义标注覆盖物在地图放大缩小时,视觉上位置偏移
  2. 原因:自定义标注图片默认基准点不在底部尖点(在左上角),位置标定不正确
  3. 解决方法:
let icon = new T.Icon({
                iconUrl: getSrc(`marker-icon${data.status}`),  //图片url
                iconSize: new T.Point(45, 45),  //图标大小
                iconAnchor: new T.Point(22.5, 45)  //设置图标中作为定位的点位,横向为大小宽度一半,竖向为大小高度一半
            });

猜你喜欢

转载自blog.csdn.net/weixin_43925630/article/details/143428267