question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rotating an object adds unexpected padding to its bounds

See original GitHub issue
Screen Shot 2021-03-27 at 9 15 18 AM

Expected Behavior

If you call getBounds() on an object you rightly get it’s bounding box parameters. I’d expect the bounds to be tight to the object whether it is rotated or not.

Current Behavior

Padding seems to be added to the object.

Possible Solution

The only thing I can think of is that pixi is generating a raster of the object and using the raster as the dimensions for calculating the bounding box even though it has the actual dimensions of the object and could use those for calculating the dimensions of the bounding box.

Perhaps this isn’t even a bug, but rather just an unexpected side effect. I just thought I should report it in case it wasn’t a known issue.

Steps to Reproduce

Create an object. Stick it in a container. Rotate the container. getBounds on the container.

https://jsfiddle.net/en1sx9jr/

Environment

  • pixi.js version: 6.0.1
  • Browser & Version: Safari 14.0.3 or Chrome or Firefox
  • OS & Version: Mac OS 11.2.2
  • Running Example: https://jsfiddle.net/en1sx9jr/

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rizencommented, Mar 28, 2021

@ivanpopelyshev basically every vector program (Illustrator, Inkscape, Corel Draw). I realize Pixi isn’t a vector editor. But unlike standard raster programs it actually maintains the properties of the shapes it draws, so it could be more accurate, like vector programs.

0reactions
stale[bot]commented, Jul 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rotating an object adds unexpected padding to its bounds
I'd expect the bounds to be tight to the object whether it is rotated or not. Current Behavior Padding seems to be added...
Read more >
Rotating an object adds unexpected padding to its bounds
Expected Behavior. If you call getBounds() on an object you rightly get it's bounding box parameters. I'd expect the bounds to be tight...
Read more >
Modifier - Android Developers
A Modifier that can add padding to position the content according to specified distances from its bounds to an alignment line .
Read more >
transform rotate and padding behaviour - css - Stack Overflow
I've got an image inside a button which is rotated 180deg and has padding-right set. The problem is that actually the padding appears...
Read more >
Joint Limits
Well essentially joint limits are when we constrain the rotation of a ... Add some padding if desired to expand limit a little...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found