PDA

View Full Version : [FIXED] bug in path conversion: Ext.draw.Draw.path2curve() (as of 4.0.7)



jsg2021
3 Nov 2011, 11:42 AM
See inline comments...



path2curve: function (path) {
var me = this,
points = me.pathToAbsolute(path),
ln = points.length,
attrs = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
i, seg, segLn, point;

for (i = 0; i < ln; i++) {
points[i] = me.command2curve(points[i], attrs);
if (points[i].length > 7) {
points[i].shift();
point = points[i];
while (point.length) {
Ext.Array.splice(points, i++, 0, ["C"].concat(Ext.Array.splice(point, 0, 6)));
}
Ext.Array.erase(points, i, 1);
ln = points.length;

/*
the value of i at this point is pointing to the
'next' command to convert... it should be restored
so the loop and the closing statements below reference
the correct element
*/
i--;//this fixes it.
}
seg = points[i];
segLn = seg.length;
attrs.x = seg[segLn - 2];
attrs.y = seg[segLn - 1];
attrs.bx = parseFloat(seg[segLn - 4]) || attrs.x;
attrs.by = parseFloat(seg[segLn - 3]) || attrs.y;
}
return points;
}

mitchellsimoens
4 Nov 2011, 5:44 AM
Thank you for the report.