diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2012-04-04 16:37:35 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2012-04-04 16:37:35 -0400 |
commit | de4044ab6436b0afaf553ecdee2f8a15fbb5ed28 (patch) | |
tree | 191b38fd18edf2a3dc48c30f8c2ffc4cca69bdef /src/library_glut.js | |
parent | 171608f25c150e833c71eaa1e5900a67d8ee69f6 (diff) |
Fix GLUT mouse func. Clicks and drags must be initiated in the canvas
Diffstat (limited to 'src/library_glut.js')
-rw-r--r-- | src/library_glut.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/library_glut.js b/src/library_glut.js index 0007d376..ba855187 100644 --- a/src/library_glut.js +++ b/src/library_glut.js @@ -34,7 +34,7 @@ var LibraryGLUT = { onMousemove: function(event) { GLUT.savePosition(event); - if (GLUT.buttons == 0 && GLUT.passiveMotionFunc) { + if (GLUT.buttons == 0 && event.target == Module.canvas && GLUT.passiveMotionFunc) { event.preventDefault(); GLUT.saveModifiers(event); FUNCTION_TABLE[GLUT.passiveMotionFunc](GLUT.lastX, GLUT.lastY); @@ -159,7 +159,10 @@ var LibraryGLUT = { GLUT.savePosition(event); GLUT.buttons |= (1 << event['button']); - if(GLUT.mouseFunc){ + if(event.target == Module.canvas && GLUT.mouseFunc){ + try { + event.target.setCapture(); + } catch (e) {} event.preventDefault(); GLUT.saveModifiers(event); FUNCTION_TABLE[GLUT.mouseFunc](event['button'], 0/*GLUT_DOWN*/, GLUT.lastX, GLUT.lastY); |