mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-22 04:11:52 +00:00
Remove incorrect offsets in polygon rendering and fix <rect> position when part of a group. Closes #113. Closes #229.
This commit is contained in:
parent
99458c3f43
commit
a0d05624ed
7 changed files with 23 additions and 27 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*! Fabric.js Copyright 2008-2012, Printio (Juriy Zaytsev, Maxim Chernyak) */
|
||||
|
||||
var fabric = fabric || { version: "0.8.47" };
|
||||
var fabric = fabric || { version: "0.8.48" };
|
||||
|
||||
if (typeof exports != 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
|
|
|
|||
22
dist/all.js
vendored
22
dist/all.js
vendored
|
|
@ -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.47" };
|
||||
var fabric = fabric || { version: "0.8.48" };
|
||||
|
||||
if (typeof exports != 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
|
|
@ -7829,13 +7829,13 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
|||
ctx.fillStyle = this.fill;
|
||||
}
|
||||
|
||||
// TODO: this breaks some shapes, need to look into it
|
||||
// if (this.group) {
|
||||
// ctx.translate(
|
||||
// -this.group.width / 2 + this.width / 2,
|
||||
// -this.group.height / 2 + this.height / 2
|
||||
// );
|
||||
// }
|
||||
if (this.group && this.type === 'rect') {
|
||||
ctx.translate(
|
||||
-this.group.width / 2 + this.width / 2,
|
||||
-this.group.height / 2 + this.height / 2
|
||||
);
|
||||
}
|
||||
|
||||
this._render(ctx, noTransform);
|
||||
|
||||
if (this.active && !noTransform) {
|
||||
|
|
@ -9936,13 +9936,11 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
|||
*/
|
||||
_render: function(ctx) {
|
||||
var point;
|
||||
var offsetX = this.minX + this.width / 2,
|
||||
offsetY = this.minY + this.height / 2;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(this.points[0].x - offsetX, this.points[0].y - offsetY);
|
||||
ctx.moveTo(this.points[0].x, this.points[0].y);
|
||||
for (var i = 0, len = this.points.length; i < len; i++) {
|
||||
point = this.points[i];
|
||||
ctx.lineTo(point.x - offsetX, point.y - offsetY);
|
||||
ctx.lineTo(point.x, point.y);
|
||||
}
|
||||
if (this.fill) {
|
||||
ctx.fill();
|
||||
|
|
|
|||
4
dist/all.min.js
vendored
4
dist/all.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
dist/all.min.js.gz
vendored
BIN
dist/all.min.js.gz
vendored
Binary file not shown.
|
|
@ -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.47",
|
||||
"version": "0.8.48",
|
||||
"author": "Juriy Zaytsev <kangax@gmail.com>",
|
||||
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],
|
||||
"repository": "git://github.com/kangax/fabric.js",
|
||||
|
|
|
|||
|
|
@ -396,13 +396,13 @@
|
|||
ctx.fillStyle = this.fill;
|
||||
}
|
||||
|
||||
// TODO: this breaks some shapes, need to look into it
|
||||
// if (this.group) {
|
||||
// ctx.translate(
|
||||
// -this.group.width / 2 + this.width / 2,
|
||||
// -this.group.height / 2 + this.height / 2
|
||||
// );
|
||||
// }
|
||||
if (this.group && this.type === 'rect') {
|
||||
ctx.translate(
|
||||
-this.group.width / 2 + this.width / 2,
|
||||
-this.group.height / 2 + this.height / 2
|
||||
);
|
||||
}
|
||||
|
||||
this._render(ctx, noTransform);
|
||||
|
||||
if (this.active && !noTransform) {
|
||||
|
|
|
|||
|
|
@ -98,13 +98,11 @@
|
|||
*/
|
||||
_render: function(ctx) {
|
||||
var point;
|
||||
var offsetX = this.minX + this.width / 2,
|
||||
offsetY = this.minY + this.height / 2;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(this.points[0].x - offsetX, this.points[0].y - offsetY);
|
||||
ctx.moveTo(this.points[0].x, this.points[0].y);
|
||||
for (var i = 0, len = this.points.length; i < len; i++) {
|
||||
point = this.points[i];
|
||||
ctx.lineTo(point.x - offsetX, point.y - offsetY);
|
||||
ctx.lineTo(point.x, point.y);
|
||||
}
|
||||
if (this.fill) {
|
||||
ctx.fill();
|
||||
|
|
|
|||
Loading…
Reference in a new issue