Fix positioning of line and image instances when part of a group

This commit is contained in:
kangax 2013-04-04 12:56:22 +02:00
parent 6e725ae18b
commit 4be589019c
2 changed files with 6 additions and 3 deletions

View file

@ -96,8 +96,10 @@
ctx.save();
var m = this.transformMatrix;
var isInPathGroup = this.group && this.group.type !== 'group';
// this._resetWidthHeight();
if (this.group) {
if (isInPathGroup) {
ctx.translate(-this.group.width/2 + this.width/2, -this.group.height/2 + this.height/2);
}
if (m) {

View file

@ -86,7 +86,8 @@
_render: function(ctx) {
ctx.beginPath();
if (this.group) {
var isInPathGroup = this.group && this.group.type !== 'group';
if (isInPathGroup) {
ctx.translate(-this.group.width/2 + this.left, -this.group.height / 2 + this.top);
}
@ -193,4 +194,4 @@
return new fabric.Line(points, object);
};
})(typeof exports !== 'undefined' ? exports : this);
})(typeof exports !== 'undefined' ? exports : this);