Add insert function for PathItem

This commit is contained in:
Jonathan Puckey 2011-02-09 01:12:03 +01:00
parent 0c53c8b29e
commit 0d1f0bf5a1

View file

@ -57,6 +57,9 @@ PathItem = Item.extend(new function() {
this.addSegment(segment); this.addSegment(segment);
}, },
insert: function(index, segment) {
this.segments.splice(index, 0, new Segment(segment));
},
moveTo: function() { moveTo: function() {
var segment = Segment.read(arguments); var segment = Segment.read(arguments);
@ -361,7 +364,7 @@ PathItem = Item.extend(new function() {
} }
cp1 = handleOut; cp1 = handleOut;
} }
if(this.closed) { if(this.closed && this.segments.length > 1) {
var segment = this.segments[0]; var segment = this.segments[0];
var point = segment.point; var point = segment.point;
var handleIn = segment.handleIn ? segment.handleIn.add(point) : point; var handleIn = segment.handleIn ? segment.handleIn.add(point) : point;