mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Fix issues with importing Ghostscript Tiger.
This commit is contained in:
parent
4320ef76ff
commit
1301aea47d
1 changed files with 9 additions and 6 deletions
|
@ -93,19 +93,19 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
||||||
control,
|
control,
|
||||||
current = new Point(); // the current position
|
current = new Point(); // the current position
|
||||||
|
|
||||||
function getCoord(index, coord, update) {
|
function getCoord(index, coord, isCurrent) {
|
||||||
var val = parseFloat(coords[index]);
|
var val = parseFloat(coords[index]);
|
||||||
if (relative)
|
if (relative)
|
||||||
val += current[coord];
|
val += current[coord];
|
||||||
if (update)
|
if (isCurrent)
|
||||||
current[coord] = val;
|
current[coord] = val;
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPoint(index, update) {
|
function getPoint(index, isCurrent) {
|
||||||
return new Point(
|
return new Point(
|
||||||
getCoord(index, 'x', update),
|
getCoord(index, 'x', isCurrent),
|
||||||
getCoord(index + 1, 'y', update)
|
getCoord(index + 1, 'y', isCurrent)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +126,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
||||||
for (var j = 0; j < length; j += 2)
|
for (var j = 0; j < length; j += 2)
|
||||||
this[j === 0 && lower === 'm' ? 'moveTo' : 'lineTo'](
|
this[j === 0 && lower === 'm' ? 'moveTo' : 'lineTo'](
|
||||||
getPoint(j, true));
|
getPoint(j, true));
|
||||||
|
control = current;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
case 'v':
|
case 'v':
|
||||||
|
@ -134,6 +135,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
||||||
getCoord(j, coord, true);
|
getCoord(j, coord, true);
|
||||||
this.lineTo(current);
|
this.lineTo(current);
|
||||||
}
|
}
|
||||||
|
control = current;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
for (var j = 0; j < length; j += 6) {
|
for (var j = 0; j < length; j += 6) {
|
||||||
|
@ -144,7 +146,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
// Shorthand cubic bezierCurveTo, absolute
|
// Smooth cubicCurveTo
|
||||||
for (var j = 0; j < length; j += 4) {
|
for (var j = 0; j < length; j += 4) {
|
||||||
this.cubicCurveTo(
|
this.cubicCurveTo(
|
||||||
// Calculate reflection of previous control points
|
// Calculate reflection of previous control points
|
||||||
|
@ -161,6 +163,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
|
// Smooth quadraticCurveTo
|
||||||
for (var j = 0; j < length; j += 2) {
|
for (var j = 0; j < length; j += 2) {
|
||||||
this.quadraticCurveTo(
|
this.quadraticCurveTo(
|
||||||
// Calculate reflection of previous control points
|
// Calculate reflection of previous control points
|
||||||
|
|
Loading…
Reference in a new issue