Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infowindow doesn't close! #2

Open
stutteringp0et opened this issue Sep 12, 2014 · 2 comments
Open

infowindow doesn't close! #2

stutteringp0et opened this issue Sep 12, 2014 · 2 comments

Comments

@stutteringp0et
Copy link

setVisible(false) doesn't work because _computeVisible runs constantly and resets visibility to true immediately.

I changed the close onclick function to use hide(), and now set a _closed property which _computeVisible and setVisible check before they change visibility.

@azulay7
Copy link

azulay7 commented Mar 6, 2017

Hi, I got the same problem. can you add code example, if you still have it :)

@jdakowicz
Copy link

I've got the similar problem!
But In my case I wanted the initial state of the info windows to be closed and I need to show them only on click on the pin.
So I changed initial state of the window to closed and not visible.
Here is the part of the code that I've changed.

...
this._visible = false;
this._closed = true; // new flag for close state
this._close.onclick = function() {
  _self.setClosed(true); // Now we are calling close method
}
this.setClosed(false); // To open a window now we need to change closed value

_.prototype.setVisible = function(visible) {
  this._visible = visible;
  this._div.style.display = visible ? 'block' : 'none';
}
_.prototype.setClosed = function(visible) {
  this._closed = visible; // changing the flag of closed
  this.setVisible(!visible); // same as before
}
...
// at the end of this method we are adding new conditional
_.prototype.computeVisible = function(){
  ...
  if(isOccluded && !this._closed){
    this.setVisible(false);
  }else if (!this._closed) {
    this.setVisible(true);
  }
}

After This changes use setClosed instead of setVisible method to manipulate the infoWindows visibilty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants