aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library_gl.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index b3d55f88..91f7d353 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -486,9 +486,11 @@ var LibraryGLUT = {
GLUT.lastX = event['clientX'];
GLUT.lastY = event['clientY'];
if (GLUT.buttons == 0 && GLUT.passiveMotionFunc) {
+ event.preventDefault ();
GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.passiveMotionFunc](GLUT.lastX, GLUT.lastY);
} else if (GLUT.buttons != 0 && GLUT.motionFunc) {
+ event.preventDefault ();
GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.motionFunc](GLUT.lastX, GLUT.lastY);
}
@@ -529,15 +531,20 @@ var LibraryGLUT = {
onKeydown: function(event) {
if (GLUT.specialFunc || GLUT.keyboardFunc) {
- GLUT.saveModifiers(event);
var key = GLUT.getSpecialKey(event['keyCode']);
if (key !== null) {
- if( GLUT.specialFunc ) FUNCTION_TABLE[GLUT.specialFunc](key, GLUT.lastX, GLUT.lastY);
+ if( GLUT.specialFunc ) {
+ event.preventDefault ();
+ GLUT.saveModifiers(event);
+ FUNCTION_TABLE[GLUT.specialFunc](key, GLUT.lastX, GLUT.lastY);
+ }
}
else
{
key = GLUT.getASCIIKey(event['keyCode']);
if( key !== null && GLUT.keyboardFunc ) {
+ event.preventDefault ();
+ GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.keyboardFunc](event['keyCode'], GLUT.lastX, GLUT.lastY);
}
}
@@ -546,15 +553,20 @@ var LibraryGLUT = {
onKeyup: function(event) {
if (GLUT.specialUpFunc || GLUT.keyboardUpFunc) {
- GLUT.saveModifiers(event);
var key = GLUT.getSpecialKey(event['keyCode']);
if (key !== null) {
- if(GLUT.specialUpFunc) FUNCTION_TABLE[GLUT.specialUpFunc](key, GLUT.lastX, GLUT.lastY);
+ if(GLUT.specialUpFunc) {
+ event.preventDefault ();
+ GLUT.saveModifiers(event);
+ FUNCTION_TABLE[GLUT.specialUpFunc](key, GLUT.lastX, GLUT.lastY);
+ }
}
else
{
key = GLUT.getASCIIKey(event['keyCode']);
if( key !== null && GLUT.keyboardUpFunc ) {
+ event.preventDefault ();
+ GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.keyboardUpFunc](event['keyCode'], GLUT.lastX, GLUT.lastY);
}
}
@@ -567,6 +579,7 @@ var LibraryGLUT = {
GLUT.buttons |= (1 << event['button']);
if(GLUT.mouseFunc){
+ event.preventDefault ();
GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.mouseFunc](event['button'], 0/*GLUT_DOWN*/, GLUT.lastX, GLUT.lastY);
}
@@ -578,6 +591,7 @@ var LibraryGLUT = {
GLUT.buttons &= ~(1 << event['button']);
if(GLUT.mouseFunc) {
+ event.preventDefault ();
GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.mouseFunc](event['button'], 1/*GLUT_UP*/, GLUT.lastX, GLUT.lastY);
}