diff options
Diffstat (limited to 'src/image.js')
-rwxr-xr-x | src/image.js | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/image.js b/src/image.js index d0a1b40..24333c7 100755 --- a/src/image.js +++ b/src/image.js @@ -1,24 +1,24 @@ -SVG.Image = function() { - this.constructor.call(this, SVG.create('image')) -} +SVG.Image = SVG.invent({ + // Initialize node + create: 'image' -// Inherit from SVG.Element -SVG.Image.prototype = new SVG.Shape + // Inherit from +, inherit: SVG.Shape -// -SVG.extend(SVG.Image, { - // (re)load image - load: function(url) { - return (url ? this.attr('href', (this.src = url), SVG.xlink) : this) + // Add class methods +, extend: { + // (re)load image + load: function(url) { + return (url ? this.attr('href', (this.src = url), SVG.xlink) : this) + } } -}) - -// -SVG.extend(SVG.Container, { - // Create image element, load image and set its size - image: function(source, width, height) { - width = width != null ? width : 100 - return this.put(new SVG.Image().load(source).size(width, height != null ? height : width)) + + // Add parent method +, construct: { + // Create image element, load image and set its size + image: function(source, width, height) { + width = width != null ? width : 100 + return this.put(new SVG.Image().load(source).size(width, height != null ? height : width)) + } } - })
\ No newline at end of file |