scenes.forEach( function ( scene ) {
var rect = scene.userData.view.getBoundingClientRect();
// check if it's offscreen. If so skip it
if ( rect.bottom < 0 || rect.top > renderer.domElement.clientHeight ||
rect.right < 0 || rect.left > renderer.domElement.clientWidth ) {
return; // it's off screen
}
// set the viewport
var width = rect.right - rect.left;
var height = rect.bottom - rect.top;
var left = rect.left;
var bottom = renderer.domElement.clientHeight - rect.bottom;
renderer.setViewport( left, bottom, width, height );
renderer.setScissor( left, bottom, width, height );
var camera = scene.userData.camera
camera.aspect = width / height;
camera.updateProjectionMatrix();
renderer.render( scene, scene.userData.camera );
} );
However, it resulted in scenes "sticking" when scrolling up/down.
How to reproduce: go to one scene and scroll fast up or down. The scene, or part of it, may get stuck to the view, as long as another scene does not appear with the scroll (i.e.: try to scroll away from any scenes).
We used to have this check in the loop:
However, it resulted in scenes "sticking" when scrolling up/down.
How to reproduce: go to one scene and scroll fast up or down. The scene, or part of it, may get stuck to the view, as long as another scene does not appear with the scroll (i.e.: try to scroll away from any scenes).