mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Simplify roundrect detection since we assume the same point sequence always.
This commit is contained in:
parent
40390f8309
commit
18b6ad4907
1 changed files with 4 additions and 12 deletions
|
@ -272,18 +272,10 @@ var SvgExporter = this.SvgExporter = new function() {
|
|||
? path._closed ? 'polygon' : 'polyline'
|
||||
: 'line';
|
||||
} else if (path._closed) {
|
||||
if (segments.length === 8) {
|
||||
var numArcs = 0,
|
||||
numColinears = 0;
|
||||
for (var i = 0; i < 8; i++) {
|
||||
if (isArc(i))
|
||||
numArcs++;
|
||||
var j = i + 4;
|
||||
if (isColinear(i, j >= 8 ? j - 8 : j))
|
||||
numColinears++;
|
||||
}
|
||||
if (numArcs === 4 && numColinears === 4)
|
||||
return 'roundrect';
|
||||
if (segments.length === 8
|
||||
&& isArc(0) && isArc(2) && isArc(4) && isArc(6)
|
||||
&& isColinear(1, 5) && isColinear(3, 7)) {
|
||||
return 'roundrect';
|
||||
} else if (segments.length === 4
|
||||
&& isArc(0) && isArc(1) && isArc(2) && isArc(3)) {
|
||||
// If the distance between (point0 and point2) and (point1
|
||||
|
|
Loading…
Reference in a new issue