[email protected] Posted April 1, 2019 Share Posted April 1, 2019 def Quote Link to comment Share on other sites More sharing options...
Exca Posted April 1, 2019 Share Posted April 1, 2019 Resize function resizes the canvas to given resolution and starts rendering with that viewport size. If you want to scale the contents then you need to scale the container. Or you can scale the canvas with css. Quote Link to comment Share on other sites More sharing options...
[email protected] Posted April 1, 2019 Author Share Posted April 1, 2019 def Quote Link to comment Share on other sites More sharing options...
Exca Posted April 1, 2019 Share Posted April 1, 2019 I have had no problems with interactionmanager not handling css-scaling. Very often you dont want to have automatic scaling. At least in my projects automatic scaling on resize would break a lot of stuff. You can do the scaling manually really easy by doing something like this: var newSize = new Rectangle(0,0, widthyouwant, heightyouwant); var originaSize = new Rectangle(0,0, something, something); //Calculate how much scaling should be done. Keep the aspect with if and make sure canvas always fits wanted size. var s = newSize.width/originalSize.width; if( s > newSize.height / originalSize.height) s = newSize.height / originalSize.height renderer.resize(newSize.width, newSize.height); mainContainer.scale.set(s,s); or you could apply that scaling to canvas like this: var newSize = new Rectangle(0,0, widthyouwant, heightyouwant); var originaSize = new Rectangle(0,0, something, something); //Calculate how much scaling should be done. Keep the aspect with if and make sure canvas always fits wanted size. var s = newSize.width/originalSize.width; if( s > newSize.height / originalSize.height) s = newSize.height / originalSize.height renderer.view.style.transformOrigin = "0 0"; renderer.view.style.transform = "scale("+s+","+s+")"; Quote Link to comment Share on other sites More sharing options...
[email protected] Posted April 1, 2019 Author Share Posted April 1, 2019 def Quote Link to comment Share on other sites More sharing options...
Exca Posted April 2, 2019 Share Posted April 2, 2019 Ah, forgot to add PIXI in front. So they should be new PIXI.Rectangle. Quote Link to comment Share on other sites More sharing options...
botmaster Posted April 2, 2019 Share Posted April 2, 2019 You can scale the stage, resize the stage, and handle any resolution using PIXI, and you can even do all this dynamically, you are merely complaining that PIXI doesn't do it YOUR WAY as if PIXI should have been developed for you and you only for some reason. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 2, 2019 Share Posted April 2, 2019 We even have the special mention in wiki: https://github.com/pixijs/pixi.js/wiki/v4-Gotchas#css-transforms-on-canvas , if you are working with css transforms and something went wrong, please teach InteractionManager to do it your way by hacking mapPositionToPoint function. I approve those hacks. Quote Link to comment Share on other sites More sharing options...
[email protected] Posted April 3, 2019 Author Share Posted April 3, 2019 def Quote Link to comment Share on other sites More sharing options...
botmaster Posted April 3, 2019 Share Posted April 3, 2019 8 hours ago, [email protected] said: future users of PIXI frustrated by the useless resize that does nothing but extend just the canvas Dude seriously what is wrong with you? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 3, 2019 Share Posted April 3, 2019 Its ok, he'll find whats wrong with native scale later 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.