ecsancho Posted January 21, 2018 Share Posted January 21, 2018 Hi for some reason the renderer is stretching and squeezing to the canvas dimensions how do I prevent that and maintain the aspect ratio? See image below. The green square is suppose to be 50x50 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 21, 2018 Share Posted January 21, 2018 How do you resize canvas? Quote Link to comment Share on other sites More sharing options...
ecsancho Posted January 21, 2018 Author Share Posted January 21, 2018 I'm not resizing on window resize. Here's my start code. this.canvas = document.getElementById('canvas') this.canvas.style.width = 600; this.canvas.style.height = 400; this.renderer = PIXI.autoDetectRenderer(600, 400,{ view:document.getElementById('canvas), backgroundColor:0xff0000, antialias:true, resolution: window.devicePixelRatio || 1, autoResize:true}); Quote Link to comment Share on other sites More sharing options...
ecsancho Posted January 21, 2018 Author Share Posted January 21, 2018 Here's another screen shot. I set the green square.x to 300px and it's way off. I just the renderer to not scale everything and stay true to the size where 1px = 1px. Thanks again Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 21, 2018 Share Posted January 21, 2018 It should work. Please provide more information. Sometimes my telepathic abilities provide a possible answer with that kind of info, but this time it failed. Quote Link to comment Share on other sites More sharing options...
ecsancho Posted January 21, 2018 Author Share Posted January 21, 2018 Sorry for the vague info this threw me off because all along I had old code that was resizing a parent container thus resizing all the nested elements . Anyhow thanks for trying help means a lot ivan.popelyshev 1 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.