Jump to content

def


5neia_opo2@google-mail.ooo
 Share

Recommended Posts

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+")";

 

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...