diff options
author | wout <wout@impinc.co.uk> | 2013-06-27 16:36:26 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-06-27 16:36:26 +0100 |
commit | 8cb2aba17829e6c9de15206b891e6c878b306a7b (patch) | |
tree | 6d3c45e02e918de27e5208f7f6516f48fe62551e /src/instance.js | |
parent | 46909dc19338e649702b6ea852120af5132bc086 (diff) | |
download | svg.js-8cb2aba17829e6c9de15206b891e6c878b306a7b.tar.gz svg.js-8cb2aba17829e6c9de15206b891e6c878b306a7b.zip |
Reworked arrange module, <defs> always on top
Diffstat (limited to 'src/instance.js')
-rw-r--r-- | src/instance.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/instance.js b/src/instance.js new file mode 100644 index 0000000..086a019 --- /dev/null +++ b/src/instance.js @@ -0,0 +1,28 @@ +SVG.Use = function() { + this.constructor.call(this, SVG.create('use')) +} + +// Inherit from SVG.Shape +SVG.Use.prototype = new SVG.Element + +// +SVG.extend(SVG.Use, { + + // (re)load image + load: function(url) { + return (url ? this.attr('xlink:href', (this.src = url), SVG.xlink) : this) + } + +}) + +// +SVG.extend(SVG.Container, { + // Create a use element + use: function(element) { + if (element instanceof SVG.Element) + element = element.id + + return this.put(new SVG.Use().) + } + +})
\ No newline at end of file |