mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Further shorten path data code.
This commit is contained in:
parent
13a567bcaa
commit
12d4d563d9
1 changed files with 16 additions and 11 deletions
|
@ -101,25 +101,30 @@ var PathItem = this.PathItem = Item.extend(/** @lends PathItem# */{
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
control = getPoint(2);
|
this.cubicCurveTo(
|
||||||
this.cubicCurveTo(getPoint(0), control, getPoint(4, true));
|
getPoint(0),
|
||||||
|
control = getPoint(2),
|
||||||
|
getPoint(4, true));
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
// Shorthand cubic bezierCurveTo, absolute
|
// Shorthand cubic bezierCurveTo, absolute
|
||||||
// Calculate reflection of previous control points
|
this.cubicCurveTo(
|
||||||
var handle = current.multiply(2).subtract(control);
|
// Calculate reflection of previous control points
|
||||||
control = getPoint(0);
|
current.multiply(2).subtract(control),
|
||||||
this.cubicCurveTo(handle, control, getPoint(2, true));
|
control = getPoint(0),
|
||||||
|
getPoint(2, true));
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
control = getPoint(0);
|
this.quadraticCurveTo(
|
||||||
this.quadraticCurveTo(control, getPoint(2, true));
|
control = getPoint(0),
|
||||||
|
getPoint(2, true));
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
for (var j = 0; j < coords.length; j += 2) {
|
for (var j = 0; j < coords.length; j += 2) {
|
||||||
// Calculate reflection of previous control points
|
this.quadraticCurveTo(
|
||||||
control = current.multiply(2).subtract(control);
|
// Calculate reflection of previous control points
|
||||||
this.quadraticCurveTo(control, getPoint(j, true));
|
control = current.multiply(2).subtract(control),
|
||||||
|
getPoint(j, true));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
|
|
Loading…
Reference in a new issue