mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Add cyclic looping to Segment#previous/next for closed paths.
This commit is contained in:
parent
92369bf14f
commit
0e89466a11
1 changed files with 7 additions and 2 deletions
|
@ -118,11 +118,16 @@ var Segment = this.Segment = Base.extend({
|
|||
},
|
||||
|
||||
getNext: function() {
|
||||
return this._path && this._path._segments[this.getIndex() + 1] || null;
|
||||
var segments = this._path && this._path._segments;
|
||||
// TODO: Port cyclic looping when closed back to Scriptographer
|
||||
return segments && (segments[this.getIndex() + 1]
|
||||
|| this._path.closed && segments[0]) || null;
|
||||
},
|
||||
|
||||
getPrevious: function() {
|
||||
return this._path && this._path._segments[this.getIndex() - 1] || null;
|
||||
var segments = this._path && this._path._segments;
|
||||
return segments && (segments[this.getIndex() - 1]
|
||||
|| this._path.closed && segments[segments.length - 1]) || null;
|
||||
},
|
||||
|
||||
_isSelected: function(point) {
|
||||
|
|
Loading…
Reference in a new issue