cesium-addons
cesium-addons copied to clipboard
infowindow doesn't close!
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.
Hi, I got the same problem. can you add code example, if you still have it :)
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