Commit 3bc12c3d by Tomas Alabes

Final fix for #629

parent f82e4ce8
...@@ -2043,6 +2043,8 @@ ...@@ -2043,6 +2043,8 @@
pp[i].shift(); pp[i].shift();
var pi = pp[i]; var pi = pp[i];
while (pi.length) { while (pi.length) {
pcoms1[i]="A"; // if created multiple C:s, their original seg is saved
p2 && (pcoms2[i]="A"); // the same as above
pp.splice(i++, 0, ["C"][concat](pi.splice(0, 6))); pp.splice(i++, 0, ["C"][concat](pi.splice(0, 6)));
} }
pp.splice(i, 1); pp.splice(i, 1);
...@@ -2058,12 +2060,40 @@ ...@@ -2058,12 +2060,40 @@
a1.y = path1[i][2]; a1.y = path1[i][2];
ii = mmax(p.length, p2 && p2.length || 0); ii = mmax(p.length, p2 && p2.length || 0);
} }
}; },
pcoms1 = [], // path commands of original path p
pcoms2 = [], // path commands of original path p2
pfirst = "", // temporary holder for original path command
pcom = ""; // holder for previous path command of original path
for (var i = 0, ii = mmax(p.length, p2 && p2.length || 0); i < ii; i++) { for (var i = 0, ii = mmax(p.length, p2 && p2.length || 0); i < ii; i++) {
p[i] = processPath(p[i], attrs); p[i] && (pfirst = p[i][0]); // save current path command
fixArc(p, i);
p2 && (p2[i] = processPath(p2[i], attrs2)); if (pfirst != "C") // C is not saved yet, because it may be result of conversion
p2 && fixArc(p2, i); {
pcoms1[i] = pfirst; // Save current path command
i && ( pcom = pcoms1[i-1]); // Get previous path command pcom
}
p[i] = processPath(p[i], attrs, pcom); // Previous path command is inputted to processPath
if (pcoms1[i] != "A" && pfirst == "C") pcoms1[i] = "C"; // A is the only command
// which may produce multiple C:s
// so we have to make sure that C is also C in original path
fixArc(p, i); // fixArc adds also the right amount of A:s to pcoms1
if (p2) { // the same procedures is done to p2
p2[i] && (pfirst = p2[i][0]);
if (pfirst != "C")
{
pcoms2[i] = pfirst;
i && (pcom = pcoms2[i-1]);
}
p2[i] = processPath(p2[i], attrs2, pcom);
if (pcoms2[i]!="A" && pfirst=="C") pcoms2[i]="C";
fixArc(p2, i);
}
fixM(p, p2, attrs, attrs2, i); fixM(p, p2, attrs, attrs2, i);
fixM(p2, p, attrs2, attrs, i); fixM(p2, p, attrs2, attrs, i);
var seg = p[i], var seg = p[i],
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2422,6 +2422,8 @@ ...@@ -2422,6 +2422,8 @@
pp[i].shift(); pp[i].shift();
var pi = pp[i]; var pi = pp[i];
while (pi.length) { while (pi.length) {
pcoms1[i]="A"; // if created multiple C:s, their original seg is saved
p2 && (pcoms2[i]="A"); // the same as above
pp.splice(i++, 0, ["C"][concat](pi.splice(0, 6))); pp.splice(i++, 0, ["C"][concat](pi.splice(0, 6)));
} }
pp.splice(i, 1); pp.splice(i, 1);
...@@ -2437,12 +2439,40 @@ ...@@ -2437,12 +2439,40 @@
a1.y = path1[i][2]; a1.y = path1[i][2];
ii = mmax(p.length, p2 && p2.length || 0); ii = mmax(p.length, p2 && p2.length || 0);
} }
}; },
pcoms1 = [], // path commands of original path p
pcoms2 = [], // path commands of original path p2
pfirst = "", // temporary holder for original path command
pcom = ""; // holder for previous path command of original path
for (var i = 0, ii = mmax(p.length, p2 && p2.length || 0); i < ii; i++) { for (var i = 0, ii = mmax(p.length, p2 && p2.length || 0); i < ii; i++) {
p[i] = processPath(p[i], attrs); p[i] && (pfirst = p[i][0]); // save current path command
fixArc(p, i);
p2 && (p2[i] = processPath(p2[i], attrs2)); if (pfirst != "C") // C is not saved yet, because it may be result of conversion
p2 && fixArc(p2, i); {
pcoms1[i] = pfirst; // Save current path command
i && ( pcom = pcoms1[i-1]); // Get previous path command pcom
}
p[i] = processPath(p[i], attrs, pcom); // Previous path command is inputted to processPath
if (pcoms1[i] != "A" && pfirst == "C") pcoms1[i] = "C"; // A is the only command
// which may produce multiple C:s
// so we have to make sure that C is also C in original path
fixArc(p, i); // fixArc adds also the right amount of A:s to pcoms1
if (p2) { // the same procedures is done to p2
p2[i] && (pfirst = p2[i][0]);
if (pfirst != "C")
{
pcoms2[i] = pfirst;
i && (pcom = pcoms2[i-1]);
}
p2[i] = processPath(p2[i], attrs2, pcom);
if (pcoms2[i]!="A" && pfirst=="C") pcoms2[i]="C";
fixArc(p2, i);
}
fixM(p, p2, attrs, attrs2, i); fixM(p, p2, attrs, attrs2, i);
fixM(p2, p, attrs2, attrs, i); fixM(p2, p, attrs2, attrs, i);
var seg = p[i], var seg = p[i],
......
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