Implement CompoundPath#firstSegment, #lastSegment, #firstCurve and #lastCurve.

This commit is contained in:
Jürg Lehni 2013-02-15 18:05:16 -08:00
parent 8f80fa16d2
commit 23b51915eb

View file

@ -82,6 +82,28 @@ var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath#
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
* {@link Path} items.
@ -96,6 +118,28 @@ var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath#
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) {
point = Point.read(arguments);
var count = 0;