Skip to content

Commit

Permalink
Whitespace fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan committed Apr 2, 2012
1 parent aba3d41 commit b36cf34
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions src/library_gl.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var LibraryGL = {
for (var i = 1; i < this.counter; i++)
if (this.table[i] == v)
return i;
return 0;
return 0;
},
};
}
Expand Down Expand Up @@ -800,22 +800,22 @@ var LibraryGLUT = {
saveModifiers: function(event) {
GLUT.modifiers = 0;
if (event['shiftKey'])
GLUT.modifiers += 1; /* GLUT_ACTIVE_SHIFT */
GLUT.modifiers += 1; /* GLUT_ACTIVE_SHIFT */
if (event['ctrlKey'])
GLUT.modifiers += 2; /* GLUT_ACTIVE_CTRL */
GLUT.modifiers += 2; /* GLUT_ACTIVE_CTRL */
if (event['altKey'])
GLUT.modifiers += 4; /* GLUT_ACTIVE_ALT */
GLUT.modifiers += 4; /* GLUT_ACTIVE_ALT */
},

onMousemove: function(event) {
GLUT.lastX = event['clientX'];
GLUT.lastY = event['clientY'];
if (GLUT.buttons == 0 && GLUT.passiveMotionFunc) {
event.preventDefault ();
event.preventDefault();
GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.passiveMotionFunc](GLUT.lastX, GLUT.lastY);
} else if (GLUT.buttons != 0 && GLUT.motionFunc) {
event.preventDefault ();
event.preventDefault();
GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.motionFunc](GLUT.lastX, GLUT.lastY);
}
Expand Down Expand Up @@ -850,73 +850,73 @@ var LibraryGLUT = {
},

getASCIIKey: function(keycode) {
// TODO apply modifiers, etc
return keycode;
// TODO apply modifiers, etc
return keycode;
},

onKeydown: function(event) {
if (GLUT.specialFunc || GLUT.keyboardFunc) {
var key = GLUT.getSpecialKey(event['keyCode']);
if (key !== null) {
if( GLUT.specialFunc ) {
event.preventDefault ();
event.preventDefault();
GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.specialFunc](key, GLUT.lastX, GLUT.lastY);
}
FUNCTION_TABLE[GLUT.specialFunc](key, GLUT.lastX, GLUT.lastY);
}
}
else
{
{
key = GLUT.getASCIIKey(event['keyCode']);
if( key !== null && GLUT.keyboardFunc ) {
event.preventDefault ();
if( key !== null && GLUT.keyboardFunc ) {
event.preventDefault();
GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.keyboardFunc](event['keyCode'], GLUT.lastX, GLUT.lastY);
}
}
}
}
},

onKeyup: function(event) {
if (GLUT.specialUpFunc || GLUT.keyboardUpFunc) {
var key = GLUT.getSpecialKey(event['keyCode']);
if (key !== null) {
if(GLUT.specialUpFunc) {
event.preventDefault ();
event.preventDefault ();
GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.specialUpFunc](key, GLUT.lastX, GLUT.lastY);
}
FUNCTION_TABLE[GLUT.specialUpFunc](key, GLUT.lastX, GLUT.lastY);
}
}
else
{
{
key = GLUT.getASCIIKey(event['keyCode']);
if( key !== null && GLUT.keyboardUpFunc ) {
event.preventDefault ();
if( key !== null && GLUT.keyboardUpFunc ) {
event.preventDefault ();
GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.keyboardUpFunc](event['keyCode'], GLUT.lastX, GLUT.lastY);
}
}
}
}
},

onMouseButtonDown: function(event){
GLUT.lastX = event['clientX'];
GLUT.lastY = event['clientY'];
GLUT.buttons |= (1 << event['button']);

if(GLUT.mouseFunc){
event.preventDefault ();
event.preventDefault();
GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.mouseFunc](event['button'], 0/*GLUT_DOWN*/, GLUT.lastX, GLUT.lastY);
}
},

onMouseButtonUp: function(event){
GLUT.lastX = event['clientX'];
GLUT.lastY = event['clientY'];
GLUT.buttons &= ~(1 << event['button']);

if(GLUT.mouseFunc) {
event.preventDefault ();
event.preventDefault();
GLUT.saveModifiers(event);
FUNCTION_TABLE[GLUT.mouseFunc](event['button'], 1/*GLUT_UP*/, GLUT.lastX, GLUT.lastY);
}
Expand Down

0 comments on commit b36cf34

Please sign in to comment.