forked from nxxcxx/Neural-Network
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevents.js
50 lines (33 loc) · 967 Bytes
/
events.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Events --------------------------------------------------------
window.addEventListener( 'keypress', function ( event ) {
var key = event.keyCode;
switch ( key ) {
case 32:/*space bar*/ sceneSettings.pause = !sceneSettings.pause;
break;
case 65:/*A*/
case 97:/*a*/ sceneSettings.enableGridHelper = !sceneSettings.enableGridHelper;
break;
case 83 :/*S*/
case 115:/*s*/ sceneSettings.enableAxisHelper = !sceneSettings.enableAxisHelper;
break;
}
} );
$( function () {
var timerID;
$( window ).resize( function () {
clearTimeout( timerID );
timerID = setTimeout( function () {
onWindowResize();
}, 250 );
} );
} );
function onWindowResize() {
WIDTH = window.innerWidth;
HEIGHT = window.innerHeight;
pixelRatio = window.devicePixelRatio || 1;
screenRatio = WIDTH / HEIGHT;
camera.aspect = screenRatio;
camera.updateProjectionMatrix();
renderer.setSize( WIDTH, HEIGHT );
renderer.setPixelRatio( pixelRatio );
}