From 4eb06f08494799833eca620d26863cfc0eec3072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 20 Oct 2014 16:51:28 +0200 Subject: [PATCH] Implement Item#isInside(rect). --- src/basic/Point.js | 4 ++-- src/item/Item.js | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/basic/Point.js b/src/basic/Point.js index 4ac8722a..f86910db 100644 --- a/src/basic/Point.js +++ b/src/basic/Point.js @@ -679,8 +679,8 @@ var Point = Base.extend(/** @lends Point# */{ * @param {Rectangle} rect the rectangle to check against * @returns {Boolean} {@true if the point is inside the rectangle} */ - isInside: function(rect) { - return rect.contains(this); + isInside: function(/* rect */) { + return Rectangle.read(arguments).contains(this); }, /** diff --git a/src/item/Item.js b/src/item/Item.js index ce0b8aab..b3d8e16e 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -1625,6 +1625,15 @@ var Item = Base.extend(Emitter, /** @lends Item# */{ return point.isInside(this.getInternalBounds()); }, + // DOCS: + /** + * @param {Rectangle} rect the rectangle to check against + * @returns {Boolean} + */ + isInside: function(/* rect */) { + return Rectangle.read(arguments).contains(this.getBounds()); + }, + /** * Perform a hit test on the item (and its children, if it is a * {@link Group} or {@link Layer}) at the location of the specified point.