diff options
author | Jeremy White <jwhite@codeweavers.com> | 2013-04-18 13:04:38 -0500 |
---|---|---|
committer | Jeremy White <jwhite@codeweavers.com> | 2013-04-18 13:04:38 -0500 |
commit | 12fe9ebb9640d22f37579a6e79542a94c48b3b3c (patch) | |
tree | 0613909d89606f1e9d53f70095db0c1ea4b7e737 | |
parent | 78e0d938cf9a1cef400a57ca3d727b9772dd4a1a (diff) |
Use document.documentElement.scrollXXX if document.body.scrollXXX is not present.
Provides compatibility for IE10.
-rw-r--r-- | spicemsg.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/spicemsg.js b/spicemsg.js index 31e54a0..365fdf7 100644 --- a/spicemsg.js +++ b/spicemsg.js @@ -639,8 +639,11 @@ function SpiceMsgcMousePosition(sc, e) this.buttons_state = sc.buttons_state; if (e) { - this.x = e.clientX - sc.display.surfaces[sc.display.primary_surface].canvas.offsetLeft + document.body.scrollLeft; - this.y = e.clientY - sc.display.surfaces[sc.display.primary_surface].canvas.offsetTop + document.body.scrollTop; + var scrollTop = document.body.scrollTop || document.documentElement.scrollTop; + var scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft; + + this.x = e.clientX - sc.display.surfaces[sc.display.primary_surface].canvas.offsetLeft + scrollLeft; + this.y = e.clientY - sc.display.surfaces[sc.display.primary_surface].canvas.offsetTop + scrollTop; sc.mousex = this.x; sc.mousey = this.y; } |