mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Use Path#isPolygon() in SvgExporter.
This commit is contained in:
parent
1050e3314e
commit
e2cf7e1ace
1 changed files with 7 additions and 20 deletions
|
@ -17,12 +17,12 @@
|
||||||
* @author Stetson-Team-Alpha
|
* @author Stetson-Team-Alpha
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name SvgExporter
|
* @name SvgExporter
|
||||||
*
|
*
|
||||||
* @class The SvgExporter object holds all the functionality to convert a
|
* @class The SvgExporter object holds all the functionality to convert a
|
||||||
* Paper.js DOM to a SVG DOM.
|
* Paper.js DOM to a SVG DOM.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var SvgExporter = this.SvgExporter = new function() {
|
var SvgExporter = this.SvgExporter = new function() {
|
||||||
|
|
||||||
|
@ -343,23 +343,10 @@ var SvgExporter = this.SvgExporter = new function() {
|
||||||
var type;
|
var type;
|
||||||
var dPoint12;
|
var dPoint12;
|
||||||
var dPoint34;
|
var dPoint34;
|
||||||
var straight = true;
|
|
||||||
var segHandleIn;
|
|
||||||
var segHandleOut;
|
|
||||||
// See if actually have any curves in the path. Differentiate
|
// See if actually have any curves in the path. Differentiate
|
||||||
// between straight objects (line, polyline, rect, and polygon) and
|
// between straight objects (line, polyline, rect, and polygon) and
|
||||||
// objects with curves(circle, ellipse, roundedRectangle).
|
// objects with curves(circle, ellipse, roundedRectangle).
|
||||||
for( var i = 0, l = segArray.length; i < l && straight; i++) {
|
if (path.isPolygon()) {
|
||||||
segHandleIn = segArray[i].getHandleIn();
|
|
||||||
segHandleOut = segArray[i].getHandleOut();
|
|
||||||
if (!segHandleIn.isZero() || !segHandleOut.isZero())
|
|
||||||
straight = false;
|
|
||||||
}
|
|
||||||
// Checks if the type of the passed in path is a rounded rectangle, an
|
|
||||||
// ellipse, a circle, or if it's simply a path.
|
|
||||||
// If there aren't any curves (straight == true), then check if the type
|
|
||||||
// is a rectangle, a polygon, a polyline, or simply a line.
|
|
||||||
if (straight) {
|
|
||||||
if (segArray.length == 4) {
|
if (segArray.length == 4) {
|
||||||
// If the distance between (point0 and point1) and (point2 and
|
// If the distance between (point0 and point1) and (point2 and
|
||||||
// point3) are equal, then it is a rectangle
|
// point3) are equal, then it is a rectangle
|
||||||
|
|
Loading…
Reference in a new issue