Jump to content

Pixi resize all containers/sprites/animated sprite/nine slace pane


jakubdev
 Share

Recommended Posts

Hello,

I try to resize all pixi.js stuff(containers/sprites/animated sprite/nine slace pane) that are on stage when browser window is resized. I can't find good solution for that as scaling up or down container influence also all childrens. Is there any way to disable this "feature"? 

Atm I think about RXJS takeLast for event(resize) and destroying view with everything and redrawing them using same textures like in first render. 

Tried to make some recursive function that was resizing everything by scale, but everything got messy.

 

 

Really appreciate help with that issue.

Link to comment
Share on other sites

> I can't find good solution for that as scaling up or down container influence also all childrens

that's the problem - so far no one found solution good enough to embed in pixi. There has to be a layout manager for that, and pixi doesnt have it

Also if you want nothing to be scaled.. then why scale at all? I mean, you want to scale container to ...what? scale only position of children and not children themselves?

Edited by ivan.popelyshev
Link to comment
Share on other sites

There's a way to ignore scale of parent:

take https://github.com/pixijs/pixijs/blob/dev/packages/math/src/Transform.ts#L230

copy it, and specify "wt.a = lt.a; wt.b=lt.b;wt.c=lt.c;wt.d=lt.d" 

you can put that function in any container like "container.transform.updateTransform = myUpdateTransform" , after that container wont obey parent scale.

Link to comment
Share on other sites

19 hours ago, ivan.popelyshev said:

> I can't find good solution for that as scaling up or down container influence also all childrens

that's the problem - so far no one found solution good enough to embed in pixi. There has to be a layout manager for that, and pixi doesnt have it

Also if you want nothing to be scaled.. then why scale at all? I mean, you want to scale container to ...what? scale only position of children and not children themselves?

Not really nothing I want to after resize for example from 812x375 to 1024x768 make every sprite bigger with fonts also changing size. 

I tried to scale only app.stage, but it produces strange behaviour after view change. For example I resize in login screen to 1024x768 and everything looks nice other than fonts that with proper algorithm can look good also, but after view change that destroy all childrens of app.stage and creates new container for view it is 3-7 times bigger than actual resolution of device and that's only resize to bigger resolution. Resize to smaller resolutions is diffrent kinda story.

Link to comment
Share on other sites

19 hours ago, ivan.popelyshev said:

There's a way to ignore scale of parent:

take https://github.com/pixijs/pixijs/blob/dev/packages/math/src/Transform.ts#L230

copy it, and specify "wt.a = lt.a; wt.b=lt.b;wt.c=lt.c;wt.d=lt.d" 

you can put that function in any container like "container.transform.updateTransform = myUpdateTransform" , after that container wont obey parent scale.

Problem with this is that even tho containers or sprites have they positions they are put on x:0,y:0.

2021-07-07_19h44_47.png

Edited by jakubdev
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...