【问题标题】:open several custom info windows at ionic cordova plugin google map在 ionic cordova plugin google map 上打开几个自定义信息窗口
【发布时间】:2017-10-06 16:56:21
【问题描述】:

我是 ionic 框架的新手。我正在构建一个应用程序,它与科尔多瓦谷歌地图插件一起使用。 我的问题是:我希望在加载地图后显示所有自定义信息窗口。我尝试了很多选择,但仍然没有运气。现在它每次点击一个标记只打开一个窗口,当我点击另一个标记时关闭它。也许有人可以帮我解决这个问题? 非常感谢!!

addMarkers(markers){
  for(let marker of markers){
    this.map.addCircle({
      center:{lat:marker.lat, lng:marker.lng},
      radius: 50,
      strokeColor: 'red',
      strokeWidth:1,
      fillColor:'red'
    });
    this.map.addMarker({

      icon: {
        'url': "./assets/marker.png",
        'size': {
          width: 27,
          height: 10
        },

      },
      animation: 'DROP',
      position: {
        lat: marker.lat,
        lng: marker.lng
      }

    }).then((marker)=>{
      marker.on(GoogleMapsEvent.MARKER_CLICK)
      .subscribe(() => {
      this.bindInfo(marker,  this.setDiv(div));

    })
    })

}

}
setDiv(div){

  let compFactory = this.resolver.resolveComponentFactory(DivComponent);
  this.compRef = compFactory.create(this.injector);
  if (this.compRef) this.compRef.instance.timeInSeconds = div.time;
  this.appRef.attachView(this.compRef.hostView);
  let div = document.createElement('div');
  div.appendChild(this.compRef.location.nativeElement);
  return div
  }
bindInfo(marker,  content){

    let info= new HtmlInfoWindow();
    info.setContent(content);
    info.open(marker)
}

【问题讨论】:

    标签: angular google-maps google-maps-api-3 cordova-plugins ionic3


    【解决方案1】:

    很遗憾,您不能同时显示多个信息窗口。

    来源: https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/329

    【讨论】:

      猜你喜欢
      • 2018-04-06
      • 2017-09-10
      • 1970-01-01
      • 1970-01-01
      • 2011-03-24
      • 2013-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多