diff options
author | wout <wout@impinc.co.uk> | 2013-06-09 11:37:26 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-06-09 11:37:26 +0100 |
commit | 8f03d84e43681ecca20ac028071e51a2e2bbc0c8 (patch) | |
tree | f5c11dc6c429e8459c20731ba775fa6ca794400f /src/image.js | |
parent | ec75128ec31aa055aca2ae7f95ad4f5cf38d12e0 (diff) | |
download | svg.js-8f03d84e43681ecca20ac028071e51a2e2bbc0c8.tar.gz svg.js-8f03d84e43681ecca20ac028071e51a2e2bbc0c8.zip |
Added deep traversing, reorganizd modules
Diffstat (limited to 'src/image.js')
-rw-r--r-- | src/image.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/image.js b/src/image.js index 7546936..b01897d 100644 --- a/src/image.js +++ b/src/image.js @@ -5,6 +5,7 @@ SVG.Image = function() { // Inherit from SVG.Element SVG.Image.prototype = new SVG.Shape +// SVG.extend(SVG.Image, { // (re)load image @@ -12,4 +13,14 @@ SVG.extend(SVG.Image, { return (url ? this.attr('xlink: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)) + } + })
\ No newline at end of file |