I want to close the infoWindow by clicking on the map, it is not possible to get the current status of the infoWindow so it will be impossible to close the opened infoWindow.
Get the feature (reading the infoWindow` opened status) added. Besides that. I don't see a way to solve this. Maybe is is possible to remove the [x] button from the infowindow by some configuration, so that mapClick() is the only means to close the infoWindow, then you can be sure the state maintained by your code is correct.
Is this fixed with #382 ? With this update you should be able to check the current infowindow state and also close all or current open infowindow (via marker property)
@brian-singer With #382 you can set an openStatus but you can't read the current status.
but you CAN set the open status to false for all open infowindows? Or not?
When you do something like this, you can:
<sebm-google-map>
<sebm-google-map-info-window [ngFor]="let i of infoWindows" [isOpen]="i.isOpen">
</sebm-google-map-info-window>
<sebm-google-map>
<button (click)="closeAll()">Close all infoWindows</button>
class MyMapComponent {
infoWindows = [ {lat: 2, lng: 2, isOpen: true}, {lat:3, lng:4, isOpen: true}];
closeAll() {
this.infoWindows.forEach((i) => i.isOpen = false);
}
great! thanks
@SebastianM, hey!
solution: save the infowindow status in the marker and then you can always check the states!
<sebm-google-map-marker *ngFor="let m of markers; let i = index"
(markerClick)="clickedMarker(i, $event)"
[latitude]="m.lat"
[longitude]="m.lng"
[markerDraggable]="m.draggable"
[iconUrl]="m.iconUrl"
(dragEnd)="markerDragEnd($event)">
<sebm-google-map-info-window [isOpen]="m.isOpen">
<infowindow [eventMarker]="m"
[allEventMarkers]="markers"
[currentIndex]="i">
</infowindow>
</sebm-google-map-info-window>
</sebm-google-map-marker>
@SebastianM this works GREAT! Thanks again :+1:
However, I just found a bug.
in MyMapComponent I have the following handler from the (markerClick):
clickedMarker(index: number) {
this.selectedMarker = index;
for (let i = 0; i < this.markers.length; i++) {
if (i !== index) {
this.markers[i].isOpen = false;
}
}
console.log(`clicked the marker: ${index}`);
}
this works the first time but after the 1st time and sequential infowindow opens it no longer works
@SebastianM after releasing my testing system I found the upgrade to 0.11.0 broke the mobile version. The weird thing is I tested the mobile view using chrome developer tools before I released my test system and after deploying my site did not work anymore. After downgrading to 0.10.0 everything is fine.
I have a suspicion this has to do with your idle event handling. I need to spend some time reviewing the code changes in this release.
Perhaps in the meantime someone can also help me testing the latest version on mobile versions of chrome?
@brian-singer I've taken a quick look at the idle event handling and couldn't find anything wrong with it... happy to help out if I can though.
Perfect. Thanks for the review
closing this issue because it is possible now for the client to preserve the info window states in-memory
If I open all the windows manually one by one, then functionality works fine as to it closes other windows and keep one window open.
But if window is opened by a marker click, then it does not close other opened windows.
any suggestion?
I would like to capture when a InfoWindow is closed and generate an event out of that? Any suggestions??
Most helpful comment
When you do something like this, you can: