mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-07-27 22:29:11 -04:00
Various changes on #isLinear(), #hasHandles() & co
Relates to #652 - Implement #hasHandles() on Path, Segment and Curve - Remove Path#isPolygon() - Define #isLinear() consistently across Path, Segment and Curve. - Introduce new Segment#isStraight()
This commit is contained in:
parent
97ca1f6ff8
commit
f8314f927e
6 changed files with 99 additions and 40 deletions
src/path
|
@ -465,12 +465,11 @@ PathItem.inject(new function() {
|
|||
// Add the path to the result, while avoiding stray segments and
|
||||
// incomplete paths. The amount of segments for valid paths depend
|
||||
// on their geometry:
|
||||
// - Closed paths with only straight lines (polygons) need more than
|
||||
// two segments.
|
||||
// - Closed paths with curves can consist of only one segment.
|
||||
// - Open paths need at least two segments.
|
||||
// - Closed paths with only straight lines need more than 2 segments
|
||||
// - Closed paths with curves can consist of only one segment
|
||||
// - Open paths need at least two segments
|
||||
if (path._segments.length >
|
||||
(path._closed ? path.isPolygon() ? 2 : 0 : 1))
|
||||
(path._closed ? path.isLinear() ? 2 : 0 : 1))
|
||||
paths.push(path);
|
||||
}
|
||||
return paths;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue