mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Simplify Shape#_contains() code.
This commit is contained in:
parent
4333334014
commit
aca9968164
1 changed files with 2 additions and 4 deletions
|
@ -257,8 +257,7 @@ new function() { // Scope for _contains() and _hitTest() code.
|
|||
|
||||
return /** @lends Shape# */{
|
||||
_contains: function _contains(point) {
|
||||
switch (this._shape) {
|
||||
case 'rectangle':
|
||||
if (this._shape === 'rectangle') {
|
||||
var center = getCornerCenter(this, point);
|
||||
return center
|
||||
// If there's a quarter ellipse center, use the same
|
||||
|
@ -266,8 +265,7 @@ new function() { // Scope for _contains() and _hitTest() code.
|
|||
? point.subtract(center).divide(this._radius)
|
||||
.getLength() <= 1
|
||||
: _contains.base.call(this, point);
|
||||
case 'circle':
|
||||
case 'ellipse':
|
||||
} else {
|
||||
return point.divide(this.size).getLength() <= 0.5;
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue