diff options
author | wout <wout@impinc.co.uk> | 2014-06-19 11:04:15 +0200 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-06-19 11:04:15 +0200 |
commit | bb0e6be2da0cea98c5303871c0be055f5f70d7a9 (patch) | |
tree | b5bf0a0cf4627e95f753251c26b9ed40c3f0386e /src | |
parent | f47dddcb601cccbd374f100c4441d7d0c151a15b (diff) | |
download | svg.js-bb0e6be2da0cea98c5303871c0be055f5f70d7a9.tar.gz svg.js-bb0e6be2da0cea98c5303871c0be055f5f70d7a9.zip |
Fixing a bug in viewbox
Diffstat (limited to 'src')
-rwxr-xr-x | src/viewbox.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/viewbox.js b/src/viewbox.js index 5f13c3e..e8736aa 100755 --- a/src/viewbox.js +++ b/src/viewbox.js @@ -5,8 +5,8 @@ SVG.ViewBox = function(element) { , hm = 1 /* height multiplier */ , box = element.bbox() , view = (element.attr('viewBox') || '').match(/-?[\d\.]+/g) - , wElement = element - , hElement = element + , we = element + , he = element /* get dimensions of current node */ width = new SVG.Number(element.width()) @@ -15,13 +15,13 @@ SVG.ViewBox = function(element) { /* find nearest non-percentual dimensions */ while (width.unit == '%') { wm *= width.value - width = new SVG.Number(wElement instanceof SVG.Doc ? wElement.parent.offsetWidth : wElement.parent.width()) - wElement = wElement.parent + width = new SVG.Number(we instanceof SVG.Doc ? we.parent.offsetWidth : we.parent.width()) + we = we.parent } while (height.unit == '%') { hm *= height.value - height = new SVG.Number(hElement instanceof SVG.Doc ? hElement.parent.offsetHeight : hElement.parent.height()) - hElement = hElement.parent + height = new SVG.Number(he instanceof SVG.Doc ? he.parent.offsetHeight : he.parent.height()) + he = he.parent } /* ensure defaults */ |