aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library_glut.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/library_glut.js b/src/library_glut.js
index cdbb347b..f1a3f00e 100644
--- a/src/library_glut.js
+++ b/src/library_glut.js
@@ -36,6 +36,15 @@ var LibraryGLUT = {
},
onMousemove: function(event) {
+ /* Pierre: Send motion event only if the motion changed, prevents
+ * spamming our app with uncessary callback call. It does happen in
+ * Chrome on Windows.
+ */
+ var newX = event['clientX'] - Module['canvas'].offsetLeft;
+ var newY = event['clientY'] - Module['canvas'].offsetTop;
+ if (newX == GLUT['lastX'] && newY == GLUT['lastY'])
+ return;
+
GLUT.savePosition(event);
if (GLUT.buttons == 0 && event.target == Module["canvas"] && GLUT.passiveMotionFunc) {
event.preventDefault();