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
This commit is contained in:
Stefan Kienzle 2013-04-08 09:25:33 +03:00
parent a0bc7b6904
commit 185686738e

View file

@ -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);