getLocalBounds() causes transform to update, can cause problems in render pass
See original GitHub issueI have found that calling DisplayObject#getLocalBounds
can mess things up if called while the renderer is rendering. This is because this method will cause a transform update after removing the parent.
In many parts of @pixi/core
, we use DisplayObject#getBounds(false)
, which will not update the transform to include the parent’s transform. This is an inherent weakness in PixiJS and should be properly documented.
To solve the problem, you must call update-transform after getting the local bounds.
target.getLocalBounds();
target.updateTransform();
However, code like Container#width
(getter) already uses the getLocalBounds()
method. This means that trying to access a display-object’s width will result in failure of the renderer.
Maybe we should solve this? @ivanpopelyshev thoughts?
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (10 by maintainers)
Top Results From Across the Web
getLocalBounds() causes transform to update, can ... - GitHub
In my apps I have separate prerender() pass where all filters and caches are measured, and elements re-positioned.
Read more >PIXI.Container - PixiJS API Documentation
Updates the transform on all children of this container for rendering. _calculateBounds () void protected. Container.ts:535.
Read more >Mesh3D | Pixi3D - v2.1.0
The material for the mesh. If the material is empty the mesh won't be rendered. ... Local bounds object, swapped with _bounds when...
Read more >Component Class Reference - JUCE
A focus container type that can be passed to setFocusContainerType(). ... Returns the transform that is currently being applied to this component.
Read more >pixi.js (v4.4.1) — Pixi.js is a fast lightweight 2D library that works ...
Constructor to create a storage for our EE objects. An Events instance is a plain object whose properties are event names. Returns. Void ......
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
@bigtimebuddy Sorry for the delay, here is a demo: https://jsfiddle.net/ShukantPal/bjc0te8x/7/.
At line 26, the
getLocalBounds()
method causes the Sprite to render at 128x128 instead of the scaled up 256x256 (due to 2x scale of stage).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.