Fix rendering bug with objects in group that also have transform attribute.

This commit is contained in:
kangax 2012-08-14 14:37:27 +02:00
parent a0d05624ed
commit 9d2f3d261b
6 changed files with 33 additions and 15 deletions

View file

@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2012, Printio (Juriy Zaytsev, Maxim Chernyak) */
var fabric = fabric || { version: "0.8.48" };
var fabric = fabric || { version: "0.8.49" };
if (typeof exports != 'undefined') {
exports.fabric = fabric;

21
dist/all.js vendored
View file

@ -1,7 +1,7 @@
/* build: `node build.js modules=ALL` */
/*! Fabric.js Copyright 2008-2012, Printio (Juriy Zaytsev, Maxim Chernyak) */
var fabric = fabric || { version: "0.8.48" };
var fabric = fabric || { version: "0.8.49" };
if (typeof exports != 'undefined') {
exports.fabric = fabric;
@ -7809,7 +7809,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
ctx.save();
var m = this.transformMatrix;
if (m) {
if (m && !this.group) {
ctx.setTransform(m[0], m[1], m[2], m[3], m[4], m[5]);
}
@ -7830,10 +7830,19 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
}
if (this.group && this.type === 'rect') {
ctx.translate(
-this.group.width / 2 + this.width / 2,
-this.group.height / 2 + this.height / 2
);
if (m) {
ctx.translate(
-this.group.width / 2,
-this.group.height / 2
);
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
}
else {
ctx.translate(
-this.group.width / 2 + this.width / 2,
-this.group.height / 2 + this.height / 2
);
}
}
this._render(ctx, noTransform);

4
dist/all.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/all.min.js.gz vendored

Binary file not shown.

View file

@ -1,7 +1,7 @@
{
"name": "fabric",
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
"version": "0.8.48",
"version": "0.8.49",
"author": "Juriy Zaytsev <kangax@gmail.com>",
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],
"repository": "git://github.com/kangax/fabric.js",

View file

@ -376,7 +376,7 @@
ctx.save();
var m = this.transformMatrix;
if (m) {
if (m && !this.group) {
ctx.setTransform(m[0], m[1], m[2], m[3], m[4], m[5]);
}
@ -397,10 +397,19 @@
}
if (this.group && this.type === 'rect') {
ctx.translate(
-this.group.width / 2 + this.width / 2,
-this.group.height / 2 + this.height / 2
);
if (m) {
ctx.translate(
-this.group.width / 2,
-this.group.height / 2
);
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
}
else {
ctx.translate(
-this.group.width / 2 + this.width / 2,
-this.group.height / 2 + this.height / 2
);
}
}
this._render(ctx, noTransform);