已解决:升级高德地图Web javascript API版本1.4.4至最新1.4.7

覆盖物-->文本标记AMap.Text 文本标记点击事件左半边不生效  求助

(marker相关的label没有点击事件)

效果图如下

高德地图采坑实践之文本标记点击事件左半边不生效(已解决)

 代码如下

          textLable = position.buildName+" ("+ position.companyNums+")"
                text = new AMap.Text({
                    map: _amap,
                    text: textLable,
                    style: {
                        'color': '#fff',
                        'background-color': '#ff4891',
                        'border': '1px solid #ffffff',
                        // 'padding': '10px 20px'
                    },
                    position: [position.lng, position.lat],
                    zIndex: 101,
                    offset:  new AMap.Pixel(20,20)
                })
                text.on('click', function () {
                    console.log("通过文字点击了楼宇")
                    if (typeof cb === 'function') {
                        // 查楼宇详情回调函数
                        cb(position)
                    }
                })

 

相关文章:

  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2021-11-17
猜你喜欢
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2021-04-26
  • 2021-12-08
  • 2021-06-22
相关资源
相似解决方案