mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-11 18:00:59 +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) */
|
||||
|
||||
var fabric = fabric || { version: "0.8.27" };
|
||||
var fabric = fabric || { version: "0.8.28" };
|
||||
|
||||
if (typeof exports != 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
|
|
|
|||
16
dist/all.js
vendored
16
dist/all.js
vendored
|
|
@ -1,7 +1,7 @@
|
|||
/* build: `node build.js modules=ALL` */
|
||||
/*! 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') {
|
||||
exports.fabric = fabric;
|
||||
|
|
@ -8668,14 +8668,16 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
|||
this.set('x2', points[2]);
|
||||
this.set('y2', points[3]);
|
||||
|
||||
this._setWidthHeight();
|
||||
this._setWidthHeight(options);
|
||||
},
|
||||
|
||||
_setWidthHeight: function() {
|
||||
this.set('width', (this.x2 - this.x1) || 1);
|
||||
this.set('height', (this.y2 - this.y1) || 1);
|
||||
this.set('left', this.x1 + this.width / 2);
|
||||
this.set('top', this.y1 + this.height / 2);
|
||||
_setWidthHeight: function(options) {
|
||||
options || (options = { });
|
||||
|
||||
this.set('width', 'width' in options ? options.width : ((this.x2 - this.x1) || 1));
|
||||
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) {
|
||||
|
|
|
|||
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.27",
|
||||
"version": "0.8.28",
|
||||
"author": "Juriy Zaytsev <kangax@gmail.com>",
|
||||
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],
|
||||
"repository": "git://github.com/kangax/fabric.js",
|
||||
|
|
|
|||
|
|
@ -43,14 +43,16 @@
|
|||
this.set('x2', points[2]);
|
||||
this.set('y2', points[3]);
|
||||
|
||||
this._setWidthHeight();
|
||||
this._setWidthHeight(options);
|
||||
},
|
||||
|
||||
_setWidthHeight: function() {
|
||||
this.set('width', (this.x2 - this.x1) || 1);
|
||||
this.set('height', (this.y2 - this.y1) || 1);
|
||||
this.set('left', this.x1 + this.width / 2);
|
||||
this.set('top', this.y1 + this.height / 2);
|
||||
_setWidthHeight: function(options) {
|
||||
options || (options = { });
|
||||
|
||||
this.set('width', 'width' in options ? options.width : ((this.x2 - this.x1) || 1));
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue