Jump to content

pixi-viewport: Scale ratio on mobile devices / Fullscreen


DiceHowl
 Share

Recommended Posts

Hi everyone!

i made a new pixi project with pixi-viewport, which i based on this fullscreen demo:

https://codesandbox.io/s/tb4qv

https://tb4qv.csb.app/

Now i tested it on various smartphones, and on some phones (google pixl 3, samsung s10e, others...) its scale ration is distorted, so the red rectangle which should be a square is displayed higher than broad.

Since its happening to the demo as well that i took as starting point, i think the problem should be reproducable there.

Does anyone has an idea what could cause that?

Greetings & thanks a lot for any idea!

DiceHowl

 

Link to comment
Share on other sites

Solved: No idea why but this solved the issue:

 

const resolution = Math.min(window.devicePixelRatio, 2);
app = new PIXI.Application({

  ....

   resolution: resolution || 1,
   antialias: resolution <= 1

}

 

Try and error did it, any reasons why it worked are still appreciated :)

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...