killlllme / google-maps-utility-library-v3

Automatically exported from code.google.com/p/google-maps-utility-library-v3
Apache License 2.0
0 stars 0 forks source link

InfoBox: add a method to check easily if the box is closed #88

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The infoBox it's a very good tool! :)

An imperfection is that it misses a simple way to check (like a method 
'isOpen()') if the instance of the box it's currently close or open.

Now to accomplish this objective i check if 'getMap()' returns the map object 
(that means that is open).

Thanks.

Original issue reported on code.google.com by iruben...@gmail.com on 18 May 2011 at 7:10

GoogleCodeExporter commented 9 years ago
You could write a closeclick handler that is called when the InfoBox is closed. 
That would allow you to keep track of the show/hide status of the InfoBox.

The getMap() technique you mention is the one to use to determine if the 
InfoBox is currently added to a map -- if it returns null, the InfoBox won't be 
visible. Same for a google.maps.InfoWindow.

Original comment by garylitt...@gmail.com on 8 Jul 2011 at 4:38

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
google.maps.event.addListener(marker, 'click', function() {
    var isOpen = ib.getMap();
    if (isOpen === null){                           
        ib.open(map, this);
    } else {
        ib.close(map, this);
    }   
});

Original comment by lewismca...@gmail.com on 8 Nov 2011 at 2:40

GoogleCodeExporter commented 9 years ago
This is just what I was looking for except for one problem. My marker click 
wasn't opening my InfoBox on the first click until I changed:
  if (isOpen === null)
to
  if (isOpen == null)

One less equal sign in the operator.

Original comment by Trevor.Vigoren on 14 Oct 2012 at 9:54