mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-26 22:14:01 +00:00
Fix lines not respecting left/top when loaded from object. Closes #151.
This commit is contained in:
parent
0cb73481dd
commit
f1cd5ebe1d
6 changed files with 21 additions and 17 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
/*! Fabric.js Copyright 2008-2012, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
|
/*! Fabric.js Copyright 2008-2012, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
|
||||||
|
|
||||||
var fabric = fabric || { version: "0.8.27" };
|
var fabric = fabric || { version: "0.8.28" };
|
||||||
|
|
||||||
if (typeof exports != 'undefined') {
|
if (typeof exports != 'undefined') {
|
||||||
exports.fabric = fabric;
|
exports.fabric = fabric;
|
||||||
|
|
|
||||||
16
dist/all.js
vendored
16
dist/all.js
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
/* build: `node build.js modules=ALL` */
|
/* build: `node build.js modules=ALL` */
|
||||||
/*! Fabric.js Copyright 2008-2012, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
|
/*! Fabric.js Copyright 2008-2012, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
|
||||||
|
|
||||||
var fabric = fabric || { version: "0.8.27" };
|
var fabric = fabric || { version: "0.8.28" };
|
||||||
|
|
||||||
if (typeof exports != 'undefined') {
|
if (typeof exports != 'undefined') {
|
||||||
exports.fabric = fabric;
|
exports.fabric = fabric;
|
||||||
|
|
@ -8668,14 +8668,16 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
||||||
this.set('x2', points[2]);
|
this.set('x2', points[2]);
|
||||||
this.set('y2', points[3]);
|
this.set('y2', points[3]);
|
||||||
|
|
||||||
this._setWidthHeight();
|
this._setWidthHeight(options);
|
||||||
},
|
},
|
||||||
|
|
||||||
_setWidthHeight: function() {
|
_setWidthHeight: function(options) {
|
||||||
this.set('width', (this.x2 - this.x1) || 1);
|
options || (options = { });
|
||||||
this.set('height', (this.y2 - this.y1) || 1);
|
|
||||||
this.set('left', this.x1 + this.width / 2);
|
this.set('width', 'width' in options ? options.width : ((this.x2 - this.x1) || 1));
|
||||||
this.set('top', this.y1 + this.height / 2);
|
this.set('height', 'height' in options ? options.height : ((this.y2 - this.y1) || 1));
|
||||||
|
this.set('left', 'left' in options ? options.left : (this.x1 + this.width / 2));
|
||||||
|
this.set('top', 'top' in options ? options.top : (this.y1 + this.height / 2));
|
||||||
},
|
},
|
||||||
|
|
||||||
set: function(name, value) {
|
set: function(name, value) {
|
||||||
|
|
|
||||||
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",
|
"name": "fabric",
|
||||||
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
|
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
|
||||||
"version": "0.8.27",
|
"version": "0.8.28",
|
||||||
"author": "Juriy Zaytsev <kangax@gmail.com>",
|
"author": "Juriy Zaytsev <kangax@gmail.com>",
|
||||||
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],
|
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],
|
||||||
"repository": "git://github.com/kangax/fabric.js",
|
"repository": "git://github.com/kangax/fabric.js",
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,16 @@
|
||||||
this.set('x2', points[2]);
|
this.set('x2', points[2]);
|
||||||
this.set('y2', points[3]);
|
this.set('y2', points[3]);
|
||||||
|
|
||||||
this._setWidthHeight();
|
this._setWidthHeight(options);
|
||||||
},
|
},
|
||||||
|
|
||||||
_setWidthHeight: function() {
|
_setWidthHeight: function(options) {
|
||||||
this.set('width', (this.x2 - this.x1) || 1);
|
options || (options = { });
|
||||||
this.set('height', (this.y2 - this.y1) || 1);
|
|
||||||
this.set('left', this.x1 + this.width / 2);
|
this.set('width', 'width' in options ? options.width : ((this.x2 - this.x1) || 1));
|
||||||
this.set('top', this.y1 + this.height / 2);
|
this.set('height', 'height' in options ? options.height : ((this.y2 - this.y1) || 1));
|
||||||
|
this.set('left', 'left' in options ? options.left : (this.x1 + this.width / 2));
|
||||||
|
this.set('top', 'top' in options ? options.top : (this.y1 + this.height / 2));
|
||||||
},
|
},
|
||||||
|
|
||||||
set: function(name, value) {
|
set: function(name, value) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue