mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Item#_getBounds: don't include bounds of hidden items.
This commit is contained in:
parent
4490403ae9
commit
34077dc901
1 changed files with 10 additions and 8 deletions
|
@ -458,14 +458,16 @@ var Item = this.Item = Base.extend({
|
|||
y1 = x1,
|
||||
y2 = x2;
|
||||
for (var i = 0, l = children.length; i < l; i++) {
|
||||
var child = children[i],
|
||||
rect = includeStroke
|
||||
? child.getStrokeBounds()
|
||||
: child.getBounds();
|
||||
x1 = Math.min(rect.x, x1);
|
||||
y1 = Math.min(rect.y, y1);
|
||||
x2 = Math.max(rect.x + rect.width, x2);
|
||||
y2 = Math.max(rect.y + rect.height, y2);
|
||||
var child = children[i];
|
||||
if (child.visible) {
|
||||
var rect = includeStroke
|
||||
? child.getStrokeBounds()
|
||||
: child.getBounds();
|
||||
x1 = Math.min(rect.x, x1);
|
||||
y1 = Math.min(rect.y, y1);
|
||||
x2 = Math.max(rect.x + rect.width, x2);
|
||||
y2 = Math.max(rect.y + rect.height, y2);
|
||||
}
|
||||
}
|
||||
return includeStroke
|
||||
? Rectangle.create(x1, y1, x2 - x1, y2 - y1)
|
||||
|
|
Loading…
Reference in a new issue