Further shorten #_getBounds() code.

This commit is contained in:
Jürg Lehni 2011-06-19 17:47:20 +01:00
parent 82ef06212b
commit 7ca9bcf38a

View file

@ -1020,7 +1020,10 @@ var Item = this.Item = Base.extend({
_getBounds: function(includeStroke) {
var children = this._children;
if (children && children.length) {
// TODO: What to return if nothing is defined, e.g. empty Groups?
// Scriptographer behaves weirdly then too.
if (!children || children.length == 0)
return new Rectangle();
var x1 = Infinity,
x2 = -Infinity,
y1 = x1,
@ -1040,10 +1043,6 @@ var Item = this.Item = Base.extend({
? Rectangle.create(x1, y1, x2 - x1, y2 - y1)
: LinkedRectangle.create(this, 'setBounds',
x1, y1, x2 - x1, y2 - y1);
}
// TODO: What to return if nothing is defined, e.g. empty Groups?
// Scriptographer behaves weirdly then too.
return new Rectangle();
},
setBounds: function(rect) {