WorldWideTelescope / wwt-web-client

The WorldWide Telescope web client lets you explore the universe in your browser.
https://worldwidetelescope.org/webclient/
MIT License
105 stars 35 forks source link

Work on display of planetary imagery #338

Closed pkgw closed 3 years ago

pkgw commented 3 years ago

There are a couple of bugfixes here for pieces of code that assumed that an "item" was a Place when it might also be an imageset.

The main change is an attempt to clean up the code to load planetary imagery. This imagery has to be loaded as a background imageset due to the way the engine works. But that caused a lot of problems because a lot of the "lookAt" related code assumes that background imagesets are only going to be in the pre-defined lists of imagery. Furthermore, the lookAt code involves a bunch of timeouts that easily induce race conditions.

Here we add a lookAtFoundImagery guard to attempt to avoid the race where the lookAt initialization process stomps on a later explicit assignment of the background imagery.

We also don't default the imageryName to "Mars" if we're not changing lookAt due to an explicit click of the dropdown menu.

We also add new background imagesets to the imagery UI list to prevent the lookAt code from overriding the settings. This isn't great but it's the only workable solution I could come up with. It has a particular weakness where the new items in the UI won't necessarily be functional since we have no way to add them to the engine's table of known imagesets.