I have a strange issue with toggling the visibility of a CZML data source. I can do an initial load and display of the data via a button press handler without any problems. I store the returned data source and can toggle its visibility off and on using another button handler. However, as soon as I pan or interact with the map, any further toggling of the visibility using the button handlers no longer seems to work.
Breakpoints in the code indicate that the handlers are still working, and I discovered that if I pan or zoom into the map (viewing as a 2D flat plane if that matters), suddenly the data source shows or hides as desired. But this strange behavior only presents if I do some sort of pan/zoom after the initial loading of the data source. requires some sort of map interaction in order to realize the change in visibility of the data source.
To help clarify the steps:
- Initialize Cesium using 2D web mercatur projection (map shows fine)
- Press show czml button. CzmlDataSource loads (first time pressed) and displays.
- Press hide button. CzmlDataSource hides
- Repeat steps 2 & 3 n times. CZML Data source shows and hides accordingly
- Pan the map or zoom into the map.
- Pressing show or hide button appears to do nothing. Panning or zooming the map will automatically refresh to the desired visibility state for the czml data source, but the ability to instantly see the show/hide state is gone. Manipulating the map in some fashion is now required to see any changes in the data source’s show state.