Rotating an object adds unexpected padding to its bounds
See original GitHub issueExpected 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:
- Created 2 years ago
- Comments:12 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
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.