mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Fix geometric and catmull-rom smooth on closed paths.
This commit is contained in:
parent
af799976d4
commit
34dc0e1589
1 changed files with 4 additions and 5 deletions
|
@ -2087,10 +2087,10 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
type = opts.type || 'asymmetric',
|
||||
segments = this._segments,
|
||||
length = segments.length,
|
||||
range = opts.from !== undefined || opts.to !== undefined,
|
||||
closed = this._closed,
|
||||
loop = closed && opts.from === undefined && opts.to === undefined,
|
||||
from = getIndex(opts.from, 0),
|
||||
to = getIndex(opts.to, length - 1),
|
||||
closed = this._closed;
|
||||
to = getIndex(opts.to, length - 1);
|
||||
if (from > to) {
|
||||
if (closed) {
|
||||
from -= length;
|
||||
|
@ -2117,7 +2117,6 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
n = amount - 1,
|
||||
// Overlap by up to 4 points on closed paths since a current
|
||||
// segment is affected by its 4 neighbors on both sides (?).
|
||||
loop = closed && !range,
|
||||
padding = loop ? min(amount, 4) : 1,
|
||||
paddingLeft = padding,
|
||||
paddingRight = padding,
|
||||
|
@ -2206,7 +2205,7 @@ var Path = PathItem.extend(/** @lends Path# */{
|
|||
// All other smoothing methods are handled directly on the segments:
|
||||
for (var i = from; i <= to; i++) {
|
||||
segments[i < 0 ? i + length : i].smooth(opts,
|
||||
i === from, i === to);
|
||||
!loop && i === from, !loop && i === to);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue