mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-11 07:13:09 +00:00
Update path.class.js
Like any other shape in fabric, when exported to svg, the shape has to be translated around origin. This additional translation brings it there. Fixes svg export of paths OUTSIDE of path-gropus. Inside was already ok.
This commit is contained in:
parent
791c74a82e
commit
28784dc9b3
1 changed files with 5 additions and 3 deletions
|
|
@ -537,19 +537,21 @@
|
|||
*/
|
||||
toSVG: function(reviver) {
|
||||
var chunks = [],
|
||||
markup = this._createBaseSVGMarkup();
|
||||
markup = this._createBaseSVGMarkup(), addTransform = '';
|
||||
|
||||
for (var i = 0, len = this.path.length; i < len; i++) {
|
||||
chunks.push(this.path[i].join(' '));
|
||||
}
|
||||
var path = chunks.join(' ');
|
||||
|
||||
if (!(this.group && this.group.type == 'path-group')) {
|
||||
addTransform = 'translate(' + (-this.width / 2) + ', ' + (-this.height / 2) + ')';
|
||||
}
|
||||
markup.push(
|
||||
//jscs:disable validateIndentation
|
||||
'<path ',
|
||||
'd="', path,
|
||||
'" style="', this.getSvgStyles(),
|
||||
'" transform="', this.getSvgTransform(),
|
||||
'" transform="', this.getSvgTransform(), addTransform,
|
||||
this.getSvgTransformMatrix(), '" stroke-linecap="round" ',
|
||||
'/>\n'
|
||||
//jscs:enable validateIndentation
|
||||
|
|
|
|||
Loading…
Reference in a new issue