diff --git a/src/color/Gradient.js b/src/color/Gradient.js index 6c9b5117..3782b4d0 100644 --- a/src/color/Gradient.js +++ b/src/color/Gradient.js @@ -16,6 +16,8 @@ * @class The Gradient object. */ var Gradient = this.Gradient = Base.extend(/** @lends Gradient# */{ + _type: 'gradient', + // TODO: Should type here be called 'radial' and have it receive a // boolean value? /** diff --git a/src/project/Symbol.js b/src/project/Symbol.js index eb7cb1ff..139907c7 100644 --- a/src/project/Symbol.js +++ b/src/project/Symbol.js @@ -20,6 +20,8 @@ * to be updated with every transformation. */ var Symbol = this.Symbol = Base.extend(/** @lends Symbol# */{ + _type: 'symbol', + /** * Creates a Symbol item. * diff --git a/src/svg/SvgExport.js b/src/svg/SvgExport.js index b3a1568e..749bc3f2 100644 --- a/src/svg/SvgExport.js +++ b/src/svg/SvgExport.js @@ -364,7 +364,7 @@ new function() { viewBox: formatRectangle(bounds) }); symbolNode.appendChild(exportSvg(definition)); - setDefinition(symbol, symbolNode, 'symbol'); + setDefinition(symbol, symbolNode); } attrs.href = '#' + symbolNode.id; attrs.x += bounds.x; @@ -421,7 +421,7 @@ new function() { attrs['stop-opacity'] = color._alpha; gradientNode.appendChild(createElement('stop', attrs)); } - setDefinition(gradient, gradientNode, 'gradient'); + setDefinition(gradient, gradientNode); } return 'url(#' + gradientNode.id + ')'; } @@ -485,8 +485,9 @@ new function() { return definitions.svgs[item._id]; } - function setDefinition(item, node, type) { - var id = definitions.ids[type] = (definitions.ids[type] || 0) + 1; + function setDefinition(item, node) { + var type = item._type, + id = definitions.ids[type] = (definitions.ids[type] || 0) + 1; node.id = type + '-' + id; definitions.svgs[item._id] = node; }