mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Further shorten code.
This commit is contained in:
parent
57103545cb
commit
93372da384
1 changed files with 4 additions and 7 deletions
|
@ -121,8 +121,7 @@ var SvgImporter = this.SvgImporter = new function() {
|
||||||
path: function(svg) {
|
path: function(svg) {
|
||||||
var path = new Path(),
|
var path = new Path(),
|
||||||
list = svg.pathSegList,
|
list = svg.pathSegList,
|
||||||
segments = path.getSegments(),
|
segments = path.getSegments();
|
||||||
relative;
|
|
||||||
for (var i = 0, l = list.numberOfItems; i < l; i++) {
|
for (var i = 0, l = list.numberOfItems; i < l; i++) {
|
||||||
// To shrink code, we replaced the long SVGPathSeg constants
|
// To shrink code, we replaced the long SVGPathSeg constants
|
||||||
// with their actual numeric values. The comments keep reference
|
// with their actual numeric values. The comments keep reference
|
||||||
|
@ -131,11 +130,9 @@ var SvgImporter = this.SvgImporter = new function() {
|
||||||
var segment = list.getItem(i);
|
var segment = list.getItem(i);
|
||||||
if (segment.pathSegType === 0) // SVGPathSeg.PATHSEG_UNKNOWN
|
if (segment.pathSegType === 0) // SVGPathSeg.PATHSEG_UNKNOWN
|
||||||
continue;
|
continue;
|
||||||
if (segment.pathSegType % 2 == 1 && segments.length > 0) {
|
var relative = segment.pathSegType % 2 == 1 && segments.length
|
||||||
relative = path.getLastSegment().getPoint();
|
? path.getLastSegment().getPoint()
|
||||||
} else {
|
: Point.create(0, 0);
|
||||||
relative = Point.create(0, 0);
|
|
||||||
}
|
|
||||||
var point = Point.create(segment.x, segment.y).add(relative);
|
var point = Point.create(segment.x, segment.y).add(relative);
|
||||||
switch (segment.pathSegType) {
|
switch (segment.pathSegType) {
|
||||||
case 1: // SVGPathSeg.PATHSEG_CLOSEPATH:
|
case 1: // SVGPathSeg.PATHSEG_CLOSEPATH:
|
||||||
|
|
Loading…
Reference in a new issue