aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
+})