diff options
Diffstat (limited to 'src/flatten.js')
-rw-r--r-- | src/flatten.js | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/flatten.js b/src/flatten.js deleted file mode 100644 index 19eebd7..0000000 --- a/src/flatten.js +++ /dev/null @@ -1,38 +0,0 @@ -SVG.extend(SVG.Parent, { - flatten: function (parent) { - // flattens is only possible for nested svgs and groups - if (!(this instanceof SVG.G || this instanceof SVG.Doc)) { - return this - } - - parent = parent || (this instanceof SVG.Doc && this.isRoot() ? this : this.parent(SVG.Parent)) - - this.each(function () { - if (this instanceof SVG.Defs) return this - if (this instanceof SVG.Parent) return this.flatten(parent) - return this.toParent(parent) - }) - - // we need this so that SVG.Doc does not get removed - this.node.firstElementChild || this.remove() - - return this - }, - ungroup: function (parent) { - // ungroup is only possible for nested svgs and groups - if (!(this instanceof SVG.G || (this instanceof SVG.Doc && !this.isRoot()))) { - return this - } - - parent = parent || this.parent(SVG.Parent) - - this.each(function () { - return this.toParent(parent) - }) - - // we need this so that SVG.Doc does not get removed - this.remove() - - return this - } -}) |