Skip to content

Commit

Permalink
fix(): group svg export
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Sep 20, 2022
1 parent 4b0130b commit 3001858
Showing 1 changed file with 33 additions and 25 deletions.
58 changes: 33 additions & 25 deletions src/shapes/group.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,22 +998,6 @@ import { Point } from '../point.class';
return fillStroke.join('');
},

/**
* Returns svg representation of an instance
* @param {Function} [reviver] Method for further parsing of svg representation.
* @return {String} svg representation of an instance
*/
_toSVG: function (reviver) {
var svgString = ['<g ', 'COMMON_PARTS', ' >\n'];
var bg = this._createSVGBgRect(reviver);
bg && svgString.push('\t\t', bg);
for (var i = 0; i < this._objects.length; i++) {
svgString.push('\t\t', this._objects[i].toSVG(reviver));
}
svgString.push('</g>\n');
return svgString;
},

/**
* Returns styles-string for svg-export, specific version for group
* @return {String}
Expand All @@ -1027,21 +1011,45 @@ import { Point } from '../point.class';
return [opacity, this.getSvgFilter(), visibility].join('');
},

/**
* @private
*/
createSVGMarkup: function (reviver, forClipping) {
const svgString = ['<g ', 'COMMON_PARTS', ' >\n'];
const bg = this._createSVGBgRect(reviver);
bg && svgString.push('\t\t', bg);
for (let i = 0; i < this._objects.length; i++) {
svgString.push(
'\t\t',
this._objects[i][forClipping ? 'toClipPathSVG' : 'toSVG'](reviver)
);
}
svgString.push('</g>\n');
return svgString;
},

/**
* Returns svg representation of an instance
* @param {Function} [reviver] Method for further parsing of svg representation.
* @return {String} svg representation of an instance
*/
_toSVG: function (reviver) {
return this.createSVGMarkup(reviver);
},

/**
* Returns svg clipPath representation of an instance
* @param {Function} [reviver] Method for further parsing of svg representation.
* @return {String} svg representation of an instance
*/
toClipPathSVG: function (reviver) {
var svgString = [];
var bg = this._createSVGBgRect(reviver);
bg && svgString.push('\t', bg);
for (var i = 0; i < this._objects.length; i++) {
svgString.push('\t', this._objects[i].toClipPathSVG(reviver));
}
return this._createBaseClipPathSVGMarkup(svgString, {
reviver: reviver,
});
return (
'\t' +
this._createBaseClipPathSVGMarkup(
this.createSVGMarkup(reviver, true),
{ reviver }
)
);
},
/* _TO_SVG_END_ */
}
Expand Down

0 comments on commit 3001858

Please sign in to comment.