Path positioning

This path positioning change renders correctly the svg 170 ( the many red triangles ) and change the visualization of issue #1363. Need extensive testing. Consider that viewbox has to be implemented better, so don't take too much negatively the errors on svgs that have viewbox with negative numbers.

if this is not a solution i hope at least it can inspire someone
This commit is contained in:
asturur 2014-06-19 23:33:12 +02:00
parent 2dc5e298a3
commit 9c444b4ecb

View file

@ -129,11 +129,13 @@
}
else { //Set center location relative to given height/width if not specified
if (!isTopSet) {
this.top = this.height / 2;
this.top = 0;
}
this.top -= this.height / 2;
if (!isLeftSet) {
this.left = this.width / 2;
this.left = 0;
}
this.left = this.width / 2
}
this.pathOffset = this.pathOffset ||
// Save top-left coords as offset
@ -146,8 +148,8 @@
*/
_calculatePathOffset: function (origLeft, origTop) {
return {
x: this.left - origLeft - (this.width / 2),
y: this.top - origTop - (this.height / 2)
x: this.left - origLeft ,
y: this.top - origTop
};
},
@ -452,6 +454,9 @@
if (!this.visible) return;
ctx.save();
if(noTransform) {
ctx.translate(this.left,this.top);
}
var m = this.transformMatrix;
if (m) {
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);