Fix path group toSvg method.

now respect current originX and originY
This commit is contained in:
Andrea Bogazzi 2015-03-01 19:21:10 +01:00 committed by asturur
parent 4ad253ffba
commit 08a1c6b418
2 changed files with 17 additions and 1 deletions

View file

@ -149,7 +149,8 @@
*/
toSVG: function(reviver) {
var objects = this.getObjects(),
translatePart = 'translate(' + this.left + ' ' + this.top + ')',
p = this.getPointByOrigin('left', 'top'),
translatePart = 'translate(' + p.x + ' ' + p.y + ')',
markup = [
//jscs:disable validateIndentation
'<g ',

View file

@ -242,4 +242,19 @@
start();
});
});
asyncTest('toSVGCenterOrigin', function() {
ok(fabric.PathGroup);
getPathGroupObject(function(pathGroup) {
ok(typeof pathGroup.toSVG == 'function');
pathGroup.originX = 'center';
pathGroup.originY = 'center';
pathGroup.width = 700;
pathGroup.height = 600;
pathGroup.left = 350;
pathGroup.top = 300;
equal(pathGroup.toSVG(), REFERENCE_PATH_GROUP_SVG);
start();
});
});
})();