From 185686738e86915f73a87aa560b2d4a686a2a28b Mon Sep 17 00:00:00 2001 From: Stefan Kienzle Date: Mon, 8 Apr 2013 09:25:33 +0300 Subject: [PATCH] fabric.Rect.fromElement() are wrong positioned If the left/top properties are 0 they are ignored - they are not normalized. http://jsfiddle.net/Kienz/3SmUC --- src/rect.class.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rect.class.js b/src/rect.class.js index 763d20e1..6f680421 100644 --- a/src/rect.class.js +++ b/src/rect.class.js @@ -206,11 +206,11 @@ * Since coordinate system differs from that of SVG */ _normalizeLeftTopProperties: function(parsedAttributes) { - if (parsedAttributes.left) { + if ('left' in parsedAttributes) { this.set('left', parsedAttributes.left + this.getWidth() / 2); } this.set('x', parsedAttributes.left || 0); - if (parsedAttributes.top) { + if ('top' in parsedAttributes) { this.set('top', parsedAttributes.top + this.getHeight() / 2); } this.set('y', parsedAttributes.top || 0);