DIV container height is increasing on window resize event

Description of the problem

When three canvas is embedded in div container the height of the div is increasing every time window.resize event occurs. I have checked it on OSX and Linux, the same behavior has been observed. The resize handling function is as follows:

window.addEventListener( 'resize', function onWindowResize() {
                    w = container.clientWidth; 
                    h = container.clientHeight; 
                    // console.log( " w : " + w + " h : " + h);
                    renderer.setSize( w, h );
                    camera.aspect = w / h;
}, false );

WebGLRenderer renderer is used. The quick fix is renderer.setSize(w, h-4) (h-6 on OSX ).
Complete code listing to replicate the issue can found on stackoverflow.
The source of WebGLRenderer shows that setSize is multiplying width and height by pixelRatio value is it possible that this messes the container height? I have checked with renderer.setPixelRatio( 1 ); but it does not solve the issue.

Thanks for your feedback.

Three.js version
  • Dev
  • r83
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
  • All of them
  • Windows
  • Linux
  • Android
  • IOS

Author: Fantashit

1 thought on “DIV container height is increasing on window resize event

Comments are closed.