mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Implement CompoundPath#firstSegment, #lastSegment, #firstCurve and #lastCurve.
This commit is contained in:
parent
8f80fa16d2
commit
23b51915eb
1 changed files with 44 additions and 0 deletions
|
@ -82,6 +82,28 @@ var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath#
|
||||||
this._children[i].smooth();
|
this._children[i].smooth();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The first Segment contained within the path.
|
||||||
|
*
|
||||||
|
* @type Segment
|
||||||
|
* @bean
|
||||||
|
*/
|
||||||
|
getFirstSegment: function() {
|
||||||
|
var first = this.getFirstChild();
|
||||||
|
return first && first.getFirstSegment();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The last Segment contained within the path.
|
||||||
|
*
|
||||||
|
* @type Segment
|
||||||
|
* @bean
|
||||||
|
*/
|
||||||
|
getLastSegment: function() {
|
||||||
|
var last = this.getLastChild();
|
||||||
|
return last && last.getLastSegment();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All the curves contained within the compound-path, from all its child
|
* All the curves contained within the compound-path, from all its child
|
||||||
* {@link Path} items.
|
* {@link Path} items.
|
||||||
|
@ -96,6 +118,28 @@ var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath#
|
||||||
return curves;
|
return curves;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The first Curve contained within the path.
|
||||||
|
*
|
||||||
|
* @type Curve
|
||||||
|
* @bean
|
||||||
|
*/
|
||||||
|
getFirstCurve: function() {
|
||||||
|
var first = this.getFirstChild();
|
||||||
|
return first && first.getFirstCurve();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The last Curve contained within the path.
|
||||||
|
*
|
||||||
|
* @type Curve
|
||||||
|
* @bean
|
||||||
|
*/
|
||||||
|
getLastCurve: function() {
|
||||||
|
var last = this.getLastChild();
|
||||||
|
return last && last.getFirstCurve();
|
||||||
|
},
|
||||||
|
|
||||||
contains: function(point) {
|
contains: function(point) {
|
||||||
point = Point.read(arguments);
|
point = Point.read(arguments);
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
Loading…
Reference in a new issue