mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Shorten #_getBounds() code.
This commit is contained in:
parent
f474bd9085
commit
82ef06212b
1 changed files with 3 additions and 4 deletions
|
@ -1024,13 +1024,12 @@ var Item = this.Item = Base.extend({
|
|||
var x1 = Infinity,
|
||||
x2 = -Infinity,
|
||||
y1 = x1,
|
||||
y2 = x2;
|
||||
y2 = x2,
|
||||
getBounds = includeStroke ? 'getStrokeBounds' : 'getBounds';
|
||||
for (var i = 0, l = children.length; i < l; i++) {
|
||||
var child = children[i];
|
||||
if (child._visible) {
|
||||
var rect = includeStroke
|
||||
? child.getStrokeBounds()
|
||||
: child.getBounds();
|
||||
var rect = child[getBounds]();
|
||||
x1 = Math.min(rect.x, x1);
|
||||
y1 = Math.min(rect.y, y1);
|
||||
x2 = Math.max(rect.x + rect.width, x2);
|
||||
|
|
Loading…
Reference in a new issue