-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Array length invalid due to hidden canvas #2662
Comments
Take a look at CesiumWidget.js#L647-L651, where |
In the short term, this is probably the best option. Longer term, may need better checks inside functions that require a non-zero canvas to work. Because fixing the default render loop does nothing if a user calls into some camera function while the canvas is hidden. Adding checks all over the place may affect performance, so more research would be needed. Since it's such an edge case, I'm not sure it's worth worrying about anytime soon. A workaround to this bug until 1.9 is out is to disable the render loop before hiding and renable it on show. |
Having the default render loop call `scene.initializeFrame` when the canvas height or width is 0 causes issues in camera code which expects these values to be non-zero. As far as I can tell, similar to `render`, there's no reason we should be calling `initializeFrame` in this case anyway. Fixes #2662 (some additional discussion there as well)
I'm not too concerned for users who manually call render on a zero-size canvas. PR looks good. |
Here's a familiar old error, with a brand new root cause.
Steps to reproduce the new way:
id="cesiumContainer"
.width: 0
. The globe will disappear, that's OK.What's happening? When the
width
is zero,CesiumWidget
sets a flag called_canRender
to false. With this flag set,Scene.initializeFrame
continues to fire at full speed, butScene.render
is never called. If mouse inertia is running, it will run off the rails here.Camera.positionWC
becomes equal to{ x: NaN, y: NaN, z: NaN }
during this time. When_canRender
becomes true again, the render loop chokes on the invalid camera position.This was found by Anne and Sunny, who are using a Bootstrap tab to hide and reveal a Cesium Viewer. If you tab away (via Bootstrap tab, not browser tab) while the globe is spinning, when you tab back there will be an exception.
The text was updated successfully, but these errors were encountered: