diff --git a/src/basic/Rectangle.js b/src/basic/Rectangle.js index 27199f71..a84638b4 100644 --- a/src/basic/Rectangle.js +++ b/src/basic/Rectangle.js @@ -470,11 +470,21 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{ * @type Point */ + /** + * The area of the rectangle in square points. + * + * @type Number + * @bean + */ + getArea: function() { + return this.width * this.height; + }, + /** * @return {Boolean} {@true the rectangle is empty} */ isEmpty: function() { - return this.width == 0 || this.height == 0; + return this.width === 0 || this.height === 0; }, /** diff --git a/src/path/PathItem.Boolean.js b/src/path/PathItem.Boolean.js index cc222cd4..657525e8 100644 --- a/src/path/PathItem.Boolean.js +++ b/src/path/PathItem.Boolean.js @@ -81,9 +81,8 @@ PathItem.inject(new function() { bounds = new Array(length), counters = new Array(length), clockwise; - children.sort(function(a, b){ - var b1 = a.getBounds(), b2 = b.getBounds(); - return b2._width * b2._height - b1._width * b1._height; + children.sort(function(a, b) { + return b.getBounds().getArea() - a.getBounds().getArea(); }); path.addChildren(children); clockwise = children[0].isClockwise();