[英]open several custom info windows at ionic cordova plugin google map
i am new at ionic framework. 我是离子框架的新手。 i am building an app, that working with cordova google map plugin. 我正在构建一个与cordova google map插件一起使用的应用程序。 my problem is that: i want all custom info windows will be displayed after the map is loaded. 我的问题是:我希望在地图加载后显示所有自定义信息窗口。 i have tried many options, but still no luck. 我尝试了很多选择,但还是没有运气。 Now it opens only one window per a click on a marker, and close it when i click on another marker. 现在,每次单击一个标记仅打开一个窗口,而当我单击另一个标记时将其关闭。 Maybe someone can help me to solve this problem? 也许有人可以帮助我解决这个问题? thanks a lot!! 非常感谢!!
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)
}
Unfortunately you can't have multiple info windows display simultaneous. 不幸的是,您不能同时显示多个信息窗口。
Source: https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/329 来源: https : //github.com/mapsplugin/cordova-plugin-googlemaps/issues/329
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.