mapvgl icon indicating copy to clipboard operation
mapvgl copied to clipboard

BMapGL.InfoWindow 有时会点击好几次才出现弹框

Open Embrace-code opened this issue 4 years ago • 7 comments

image 点击时 调用这个方法 每次都能输出新的item 但是并不是每次都会出来弹框 点击标记点第一次会出现 点击其他的标记点都是点击三次才出现弹框

Embrace-code avatar Dec 03 '20 09:12 Embrace-code

我也遇到这个问题了,暂时给打开加了个延时解决了 setTimeout(()=>{ map.openInfoWindow(infoWindow, point); }, 20)

louyanqi avatar Dec 04 '20 03:12 louyanqi

3q 暂时能达到想要的效果

Embrace-code avatar Dec 04 '20 03:12 Embrace-code

我也有类似的bug。 主要代码:

//数字序号
let indexLayer = new mapvgl.TextLayer({
  depthTest: false, //notice: 解决(地图容器height=500px、501px、510px等值时)textLayer会被PointLayer覆盖的bug
  enablePicked: true,
  onClick: e=>{
    if (e.dataIndex<0) return false //notice: 解决点击的无效数据元素索引
    let row = this.onlineGps[e.dataIndex]
    let opts = {
      title: `<a href="/device-detail/${row.dev_id}">${id2mac(row.dev_id)}</a>`,
    }
    let infoWindow = new window.BMapGL.InfoWindow(row.address, opts)
    this.mymap.openInfoWindow(infoWindow, new window.BMapGL.Point(row.lon, row.lat)) //打开信息窗口
  },
  data: data2,
})
this.mapView.addLayer(indexLayer)

现象:点击某个TextLayer时,第一次正常显示InfoWindow,第二次消失,第三次没反应。

troublezzb avatar Dec 23 '20 11:12 troublezzb

一样 加个延时 不知道 你是否能达到你想要的效果

Embrace-code avatar Dec 24 '20 05:12 Embrace-code

我也有类似的bug。 主要代码:

//数字序号
let indexLayer = new mapvgl.TextLayer({
  depthTest: false, //notice: 解决(地图容器height=500px、501px、510px等值时)textLayer会被PointLayer覆盖的bug
  enablePicked: true,
  onClick: e=>{
    if (e.dataIndex<0) return false //notice: 解决点击的无效数据元素索引
    let row = this.onlineGps[e.dataIndex]
    let opts = {
      title: `<a href="/device-detail/${row.dev_id}">${id2mac(row.dev_id)}</a>`,
    }
    let infoWindow = new window.BMapGL.InfoWindow(row.address, opts)
    this.mymap.openInfoWindow(infoWindow, new window.BMapGL.Point(row.lon, row.lat)) //打开信息窗口
  },
  data: data2,
})
this.mapView.addLayer(indexLayer)

现象:点击某个TextLayer时,第一次正常显示InfoWindow,第二次消失,第三次没反应。

const point = new BMapGL.Point(item.geometry.coordinates[0], item.geometry.coordinates[1]) let infoWindow = new BMapGL.InfoWindow('站点名称:' + item.StationName + '
智能设备:' + item.DeviceCount + '
订单量:' + item.OrderCount, opts) // 创建信息窗口对象 this.setItimer = setTimeout(() => { this.map.openInfoWindow(infoWindow, point) },20) 你看看 是否能达到你想要的效果

Embrace-code avatar Dec 24 '20 05:12 Embrace-code

我也有类似的bug。 主要代码:

//数字序号
let indexLayer = new mapvgl.TextLayer({
  depthTest: false, //notice: 解决(地图容器height=500px、501px、510px等值时)textLayer会被PointLayer覆盖的bug
  enablePicked: true,
  onClick: e=>{
    if (e.dataIndex<0) return false //notice: 解决点击的无效数据元素索引
    let row = this.onlineGps[e.dataIndex]
    let opts = {
      title: `<a href="/device-detail/${row.dev_id}">${id2mac(row.dev_id)}</a>`,
    }
    let infoWindow = new window.BMapGL.InfoWindow(row.address, opts)
    this.mymap.openInfoWindow(infoWindow, new window.BMapGL.Point(row.lon, row.lat)) //打开信息窗口
  },
  data: data2,
})
this.mapView.addLayer(indexLayer)

现象:点击某个TextLayer时,第一次正常显示InfoWindow,第二次消失,第三次没反应。

const point = new BMapGL.Point(item.geometry.coordinates[0], item.geometry.coordinates[1]) let infoWindow = new BMapGL.InfoWindow('站点名称:' + item.StationName + ' 智能设备:' + item.DeviceCount + ' 订单量:' + item.OrderCount, opts) // 创建信息窗口对象 this.setItimer = setTimeout(() => { this.map.openInfoWindow(infoWindow, point) },20) 你看看 是否能达到你想要的效果

3q 暂时能达到想要的效果。好像js这类怪异的bug一般用setTimeout都能搞定。

troublezzb avatar Dec 24 '20 06:12 troublezzb

我也发现了这个bug,不知道啥时候能够修复

sunkingsss avatar Jul 15 '21 06:07 sunkingsss