Tylox Posted August 23, 2016 Share Posted August 23, 2016 Hello, Because of performance and blurry text/image issues, I turned my fixed canvas resolution to a canvas with width/height dynamically equal to window.innerWidth/Height on resize. Admitting the same aspect ratio after resizing, how would you deal with the renderer to keep the same viewport ? Thanks. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted August 23, 2016 Share Posted August 23, 2016 Something must be done like "stage.scale.set(renderer.width/960)" , where 960 is your original width Sein and Tylox 2 Quote Link to comment Share on other sites More sharing options...
Exca Posted August 23, 2016 Share Posted August 23, 2016 var aspect = 16/9; var w = window.innerWidth; var h = window.innerHeight; if(w > h * aspect) { //Height is the limiting factor w = h*aspect; } else { //Width is the limiting factor h = w*1/aspect; } renderer.resize(w, h); The aspect ratio isn't totally correct after resize due to rounding errors. After that just use css to center the canvas and maybe add some nice ornaments (or something) to the edges with extra space. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.