mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-22 06:54:42 +00:00
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:
parent
2dc5e298a3
commit
9c444b4ecb
1 changed files with 9 additions and 4 deletions
|
|
@ -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]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue