Commit ad15a1c9 by Tomas Alabes

Raphael.path2curve does not honor original shape. By @timo22345

parent 5ae20867
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -1997,13 +1997,25 @@ ...@@ -1997,13 +1997,25 @@
path = ["C"][concat](a2c[apply](0, [d.x, d.y][concat](path.slice(1)))); path = ["C"][concat](a2c[apply](0, [d.x, d.y][concat](path.slice(1))));
break; break;
case "S": case "S":
nx = d.x + (d.x - (d.bx || d.x)); if (pcom == "C" || pcom == "S") { // In "S" case we have to take into account, if the previous command is C/S.
ny = d.y + (d.y - (d.by || d.y)); nx = d.x * 2 - d.bx; // And reflect the previous
ny = d.y * 2 - d.by; // command's control point relative to the current point.
}
else { // or some else or nothing
nx = d.x;
ny = d.y;
}
path = ["C", nx, ny][concat](path.slice(1)); path = ["C", nx, ny][concat](path.slice(1));
break; break;
case "T": case "T":
d.qx = d.x + (d.x - (d.qx || d.x)); if (pcom == "Q" || pcom == "T") { // In "T" case we have to take into account, if the previous command is Q/T.
d.qy = d.y + (d.y - (d.qy || d.y)); d.qx = d.x * 2 - d.qx; // And make a reflection similar
d.qy = d.y * 2 - d.qy; // to case "S".
}
else { // or something else or nothing
d.qx = d.x;
d.qy = d.y;
}
path = ["C"][concat](q2c(d.x, d.y, d.qx, d.qy, path[1], path[2])); path = ["C"][concat](q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));
break; break;
case "Q": case "Q":
......
...@@ -2376,13 +2376,25 @@ ...@@ -2376,13 +2376,25 @@
path = ["C"][concat](a2c[apply](0, [d.x, d.y][concat](path.slice(1)))); path = ["C"][concat](a2c[apply](0, [d.x, d.y][concat](path.slice(1))));
break; break;
case "S": case "S":
nx = d.x + (d.x - (d.bx || d.x)); if (pcom == "C" || pcom == "S") { // In "S" case we have to take into account, if the previous command is C/S.
ny = d.y + (d.y - (d.by || d.y)); nx = d.x * 2 - d.bx; // And reflect the previous
ny = d.y * 2 - d.by; // command's control point relative to the current point.
}
else { // or some else or nothing
nx = d.x;
ny = d.y;
}
path = ["C", nx, ny][concat](path.slice(1)); path = ["C", nx, ny][concat](path.slice(1));
break; break;
case "T": case "T":
d.qx = d.x + (d.x - (d.qx || d.x)); if (pcom == "Q" || pcom == "T") { // In "T" case we have to take into account, if the previous command is Q/T.
d.qy = d.y + (d.y - (d.qy || d.y)); d.qx = d.x * 2 - d.qx; // And make a reflection similar
d.qy = d.y * 2 - d.qy; // to case "S".
}
else { // or something else or nothing
d.qx = d.x;
d.qy = d.y;
}
path = ["C"][concat](q2c(d.x, d.y, d.qx, d.qy, path[1], path[2])); path = ["C"][concat](q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));
break; break;
case "Q": case "Q":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment