aboutsummaryrefslogtreecommitdiff
path: root/src/proxyWorker.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-09 13:39:08 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-09 13:39:08 -0700
commitf0d162c73462784e1b0f6dcb3f040f12103cfe5c (patch)
treecbde8aab1bcd2b92f028c98d2ec486e39679f490 /src/proxyWorker.js
parent92fe68caa71f9a78b2767f5b618206eb1495aac8 (diff)
proxy boundingClientRect
Diffstat (limited to 'src/proxyWorker.js')
-rw-r--r--src/proxyWorker.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/proxyWorker.js b/src/proxyWorker.js
index 8d641b0d..29b2528d 100644
--- a/src/proxyWorker.js
+++ b/src/proxyWorker.js
@@ -62,6 +62,17 @@ document.createElement = function(what) {
}
};
};
+ canvas.boundingClientRect = {};
+ canvas.getBoundingClientRect = function() {
+ return {
+ width: canvas.boundingClientRect.width,
+ height: canvas.boundingClientRect.height,
+ top: canvas.boundingClientRect.top,
+ left: canvas.boundingClientRect.left,
+ bottom: canvas.boundingClientRect.bottom,
+ right: canvas.boundingClientRect.right
+ };
+ };
return canvas;
}
default: throw 'document.createElement ' + what;
@@ -119,7 +130,11 @@ onmessage = function(message) {
break;
}
case 'canvas': {
- Module.canvas.fireEvent(message.data.event);
+ if (message.data.event) {
+ Module.canvas.fireEvent(message.data.event);
+ } else if (message.data.boundingClientRect) {
+ Module.canvas.boundingClientRect = message.data.boundingClientRect;
+ } else throw 'ey?';
break;
}
default: throw 'wha? ' + message.data.target;