aboutsummaryrefslogtreecommitdiffstats
path: root/src/viewbox.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-03-29 17:28:40 +0000
committerwout <wout@impinc.co.uk>2013-03-29 17:28:40 +0000
commit87f9985c2d2d3ec3a732613b02d281084d096d1f (patch)
tree3854dd524fd788c25e2c9db55ea6528ab29a96b0 /src/viewbox.js
parent7eb8f7923a63622a4ebbd17f8afd101f564fbf48 (diff)
downloadsvg.js-87f9985c2d2d3ec3a732613b02d281084d096d1f.tar.gz
svg.js-87f9985c2d2d3ec3a732613b02d281084d096d1f.zip
Fix in viewbox() method
Diffstat (limited to 'src/viewbox.js')
-rw-r--r--src/viewbox.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/viewbox.js b/src/viewbox.js
index 05fb15e..f06ab6d 100644
--- a/src/viewbox.js
+++ b/src/viewbox.js
@@ -2,7 +2,7 @@
SVG.ViewBox = function(element) {
var x, y, width, height
, box = element.bbox()
- , view = (element.attr('viewBox') || '').match(/[\d\.]+/g)
+ , view = (element.attr('viewBox') || '').match(/-?[\d\.]+/g)
/* clone attributes */
this.x = box.x
@@ -14,8 +14,8 @@ SVG.ViewBox = function(element) {
/* get width and height from viewbox */
x = parseFloat(view[0])
y = parseFloat(view[1])
- width = parseFloat(view[2]) - x
- height = parseFloat(view[3]) - y
+ width = parseFloat(view[2])
+ height = parseFloat(view[3])
/* calculate zoom accoring to viewbox */
this.zoom = ((this.width / this.height) > (width / height)) ?