mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
Container.getBounds now checks if it can call getBounds
on its children before doing so, as some do not have this method (such as Graphics objects) so they no longer cause the call to crash. Fix #3623
This commit is contained in:
parent
8d6eb2f9ed
commit
9fa74400ab
1 changed files with 8 additions and 2 deletions
|
@ -293,6 +293,9 @@ var Container = new Class({
|
|||
* Gets the bounds of this Container. It works by iterating all children of the Container,
|
||||
* getting their respective bounds, and then working out a min-max rectangle from that.
|
||||
* It does not factor in if the children render or not, all are included.
|
||||
*
|
||||
* Some children are unable to return their bounds, such as Graphics objects, in which case
|
||||
* they are skipped.
|
||||
*
|
||||
* Depending on the quantity of children in this Container it could be a really expensive call,
|
||||
* so cache it and only poll it as needed.
|
||||
|
@ -321,9 +324,12 @@ var Container = new Class({
|
|||
{
|
||||
var entry = children[i];
|
||||
|
||||
entry.getBounds(tempRect);
|
||||
if (entry.getBounds)
|
||||
{
|
||||
entry.getBounds(tempRect);
|
||||
|
||||
Union(tempRect, output, output);
|
||||
Union(tempRect, output, output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue