mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Fix Path#flatten(), where we don't want to add last segment again for closed paths.
This commit is contained in:
parent
8e6adbc284
commit
23f38c6e5b
1 changed files with 4 additions and 2 deletions
|
@ -687,8 +687,10 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
|||
pos = 0,
|
||||
// Adapt step = maxDistance so the points distribute evenly.
|
||||
step = flattener.length / Math.ceil(flattener.length / maxDistance),
|
||||
// Add half of step to end, so imprecisions are ok too.
|
||||
end = flattener.length + step / 2;
|
||||
// Add/remove half of step to end, so imprecisions are ok too.
|
||||
// For closed paths, remove it, because we don't want to add last
|
||||
// segment again
|
||||
end = flattener.length + (this._closed ? -step : step) / 2;
|
||||
// Iterate over path and evaluate and add points at given offsets
|
||||
var segments = [];
|
||||
while (pos <= end) {
|
||||
|
|
Loading…
Reference in a new issue