mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 22:52:14 +00:00
Only render compound bounds
This commit is contained in:
parent
312f4dab10
commit
4d0618232b
1 changed files with 24 additions and 8 deletions
|
@ -1569,6 +1569,8 @@ var World = new Class({
|
|||
/**
|
||||
* Renders the bounds of an array of Bodies to the given Graphics instance.
|
||||
*
|
||||
* If the body is a compound body, it will render the bounds for the parent compound.
|
||||
*
|
||||
* The debug renderer calls this method if the `showBounds` config value is set.
|
||||
*
|
||||
* This method is used internally by the Matter Debug Renderer, but is also exposed publically should
|
||||
|
@ -1596,6 +1598,19 @@ var World = new Class({
|
|||
continue;
|
||||
}
|
||||
|
||||
var bounds = body.bounds;
|
||||
|
||||
if (bounds)
|
||||
{
|
||||
graphics.strokeRect(
|
||||
bounds.min.x,
|
||||
bounds.min.y,
|
||||
bounds.max.x - bounds.min.x,
|
||||
bounds.max.y - bounds.min.y
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
var parts = body.parts;
|
||||
|
||||
for (var j = parts.length > 1 ? 1 : 0; j < parts.length; j++)
|
||||
|
@ -1610,6 +1625,7 @@ var World = new Class({
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue