高德地图2.0 普通mark标记渲染

const window = getinfoWindow(point)
const insMarker = getMarker(ins, colors[0])
setWindow(insMarker , window)
insMarker.setMap(map)

//切换信息窗体显示隐藏
const setWindow = (marker, window) => {
    marker.on('mouseover', function(e){
    window.open(map, [e.lnglat.lng, e.lnglat.lat]);
  });
    marker.on('mouseout', function (e) {
      window.close();
    });
}

const getMarker = (center, color) => {
    return new AMap.CircleMarker({
    center:[center.x, center.y],
    radius: 7,
    strokeColor: color,
    strokeWeight: 1,
    strokeOpacity: 1,
    fillColor: color,
    fill0pacity: 1,
    zIndex: 10,
    bubble: true,
    cursor: 'pointer',
    clickable: true
})
}

const getInfoWindow = (info) => {
  return new AMap.InfoWindow({
   offset: new AMap.Pixel(0, -10),
   autoMove: true,//当信息窗体超出地图边界时,自动移动地图使信息窗体完全显示
   content: `<div class="map-point-info">bagid : ${info.bagId}</div>
   <div class="map-point-info">bagname:${info.bagName}</div>
   <div class="map-point-info">时间戳:${info.timestamp}</div>`
})
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容