CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.85k stars 3.47k forks source link

Cesium resize issue #217

Closed mramato closed 12 years ago

mramato commented 12 years ago
  1. Dock browser to side of screen in Windows 7 (doesn't matter which side)
  2. Start CesiumViewer.
  3. Undock to bring the window to a different size
  4. Transition to 2D mode

The aspect ratio is now screwed and the map is all stretched out. Even switching back to 3D now shows an oblong globe.

emackey commented 12 years ago

Looks like the resize handler is still getting called, and a correct new aspect ratio is being computed but not used.

Here's another way to reproduce: Start the CesiumViewer app in a wide browser window, then click the '2D' button, then shrink the window to be thin. At first it shows signs of working, but then there's a black frame flash, and then it shows a stretched map as if the aspect ratio is unchanged from the default.

After the bug shows, changing out of 2D mode back to 3D, shows the wrong aspect only until the next resize event happens, at which point the correct resize behavior resumes.

@bagnell can you take a look at why 2D mode might sometimes use a constant aspectRatio while 3D & Columbus mode use a computed aspectRatio?

bagnell commented 12 years ago

@emackey In 2D, we use an orthographic projection which doesn't have an aspectRatio property so the top, and bottom distances have to be adjusted. The right and left remain constant at +/- half the circumference of the earth at the equator.

emackey commented 12 years ago

This is fixed by #220.