mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Don't overuse variable chaining - use only were readibility does not suffer.
This commit is contained in:
parent
3078e74f27
commit
057b71ff4c
1 changed files with 12 additions and 12 deletions
|
@ -855,20 +855,20 @@ var Path = this.Path = PathItem.extend({
|
||||||
inc = Math.min(Math.max(extent, -d180), d180) / arcSegs,
|
inc = Math.min(Math.max(extent, -d180), d180) / arcSegs,
|
||||||
z = 4 / 3 * Math.sin(inc / 2) / (1 + Math.cos(inc / 2)),
|
z = 4 / 3 * Math.sin(inc / 2) / (1 + Math.cos(inc / 2)),
|
||||||
segments = [];
|
segments = [];
|
||||||
// TODO: Use Point#setAngle() and Point vector algebra instead.
|
// TODO: Use Point#setAngle() and Point vector algebra instead?
|
||||||
for (var i = 0; i <= arcSegs; i++) {
|
for (var i = 0; i <= arcSegs; i++) {
|
||||||
var relx = Math.cos(angle),
|
var relx = Math.cos(angle),
|
||||||
rely = Math.sin(angle),
|
rely = Math.sin(angle);
|
||||||
pt = new Point(
|
var pt = new Point(
|
||||||
cx + relx * radius,
|
cx + relx * radius,
|
||||||
cy + rely * radius
|
cy + rely * radius
|
||||||
),
|
);
|
||||||
out = i == arcSegs
|
var out = i == arcSegs
|
||||||
? null
|
? null
|
||||||
: new Point(
|
: new Point(
|
||||||
cx + (relx - z * rely) * radius - pt.x,
|
cx + (relx - z * rely) * radius - pt.x,
|
||||||
cy + (rely + z * relx) * radius - pt.y
|
cy + (rely + z * relx) * radius - pt.y
|
||||||
);
|
);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
// Modify startSegment
|
// Modify startSegment
|
||||||
current.setHandleOut(out);
|
current.setHandleOut(out);
|
||||||
|
|
Loading…
Reference in a new issue