add: last_time = Date.now(); 
context:     controls = (function() {      function generate() {        global.addEventListener('mousemove', function(e) {          if(!mouse.x) mouse.x = e.screenX;          if(!mouse.y) mouse.y = e.screenY;          if(mouse.y !== e.screenY)            NEngine.math.rotateNormalized(camera.rw,camera.rz,              (e.screenY - mouse.y)*settings.mouse_rotation);          if(mouse.x !== e.screenX) {            if(e.button === 2)              NEngine.math.rotateNormalized(camera.rw, camera.rx,                (e.screenX - mouse.x)*settings.mouse_rotation);            else              NEngine.math.rotateNormalized(camera.rw,camera.ry,                (e.screenX - mouse.x)*settings.mouse_rotation);          }          global.addEventListener('keydown', function(e) {            //console.log(e);            switch(e.keyCode) {              case 87:                vec4.scale(tmp_v1, camera.rz, settings.speed*(Date.now() - last_time));                vec4.add(camera.p, camera.p, tmp_v1);                break;            }            //e.preventDefault();            e.stopPropagation();          });          mouse.x = e.screenX;          mouse.y = e.screenY;        }, false);        global.addEventListener('click', function(e) {          e.stopPropagation();          e.preventDefault();          return false;        }, true);        global.addEventListener('contextmenu', function(e) {          e.stopPropagation();          e.preventDefault();          return false;        }, true);      }      return {        generate: generate      };    })();
meta: 5665	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5665/0f8ba5d109269d49d72be1d776721a5a867dd729/NGrid.js/buggy/lib/NGrid.js