aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWout <wout@impinc.co.uk>2014-06-12 10:58:24 +0200
committerWout <wout@impinc.co.uk>2014-06-12 10:58:24 +0200
commit7eca0940834bc8acb5e495add99c043ba474aa84 (patch)
tree7568b43e67cc5d8b913a63cdbfa6e4fb267c625c
parent4f25891a6b84011752e5d024b4052b847cda51ec (diff)
parentff6089410a03acda00fb8cb2f09ed94d7228dd4c (diff)
downloadsvg.js-7eca0940834bc8acb5e495add99c043ba474aa84.tar.gz
svg.js-7eca0940834bc8acb5e495add99c043ba474aa84.zip
Merge pull request #207 from bryhoyt/patch-1
Offset rbox by window scroll, because getBoundingClientRect changes when...
-rwxr-xr-xsrc/rbox.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rbox.js b/src/rbox.js
index 30779a4..54e08cb 100755
--- a/src/rbox.js
+++ b/src/rbox.js
@@ -46,6 +46,10 @@ SVG.RBox = function(element) {
this.width = box.width /= zoom
this.height = box.height /= zoom
+ /* offset by window scroll position, because getBoundingClientRect changes when window is scrolled */
+ this.x += window.scrollX;
+ this.y += window.scrollY;
+
/* add center, right and bottom */
boxProperties(this)
@@ -69,4 +73,4 @@ SVG.extend(SVG.RBox, {
return b
}
-}) \ No newline at end of file
+})