mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Implement Item#isInside(rect).
This commit is contained in:
parent
ad50e9f604
commit
4eb06f0849
2 changed files with 11 additions and 2 deletions
|
@ -679,8 +679,8 @@ var Point = Base.extend(/** @lends Point# */{
|
||||||
* @param {Rectangle} rect the rectangle to check against
|
* @param {Rectangle} rect the rectangle to check against
|
||||||
* @returns {Boolean} {@true if the point is inside the rectangle}
|
* @returns {Boolean} {@true if the point is inside the rectangle}
|
||||||
*/
|
*/
|
||||||
isInside: function(rect) {
|
isInside: function(/* rect */) {
|
||||||
return rect.contains(this);
|
return Rectangle.read(arguments).contains(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1625,6 +1625,15 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
return point.isInside(this.getInternalBounds());
|
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
|
* 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.
|
* {@link Group} or {@link Layer}) at the location of the specified point.
|
||||||
|
|
Loading…
Reference in a new issue