@@ -553,15 +553,16 @@ var LibrarySDL = {
553
553
receiveEvent ( event ) {
554
554
function unpressAllPressedKeys ( ) {
555
555
// Un-press all pressed keys: TODO
556
- for ( var code in SDL . keyboardMap ) {
556
+ for ( var keyCode of SDL . keyboardMap ) {
557
557
SDL . events . push ( {
558
558
type : 'keyup' ,
559
- keyCode : SDL . keyboardMap [ code ]
559
+ keyCode,
560
560
} ) ;
561
561
}
562
562
} ;
563
563
switch ( event . type ) {
564
- case 'touchstart' : case 'touchmove' : {
564
+ case 'touchstart' :
565
+ case 'touchmove' : {
565
566
event . preventDefault ( ) ;
566
567
567
568
var touches = [ ] ;
@@ -637,7 +638,9 @@ var LibrarySDL = {
637
638
} ;
638
639
break ;
639
640
}
640
- case 'DOMMouseScroll' : case 'mousewheel' : case 'wheel' :
641
+ case 'DOMMouseScroll' :
642
+ case 'mousewheel' :
643
+ case 'wheel' :
641
644
// Flip the wheel direction to translate from browser wheel direction
642
645
// (+:down) to SDL direction (+:up)
643
646
var delta = - Browser . getMouseWheelDelta ( event ) ;
@@ -684,7 +687,11 @@ var LibrarySDL = {
684
687
}
685
688
}
686
689
// fall through
687
- case 'keydown ': case 'keyup ': case 'keypress ': case 'mousedown ': case 'mouseup ':
690
+ case 'keydown ':
691
+ case 'keyup ':
692
+ case 'keypress ':
693
+ case 'mousedown ':
694
+ case 'mouseup ':
688
695
// If we preventDefault on keydown events, the subsequent keypress events
689
696
// won't fire. However, it's fine (and in some cases necessary) to
690
697
// preventDefault for keys that don't generate a character. Otherwise,
@@ -834,11 +841,14 @@ var LibrarySDL = {
834
841
event . handled = true ;
835
842
836
843
switch ( event . type ) {
837
- case 'touchstart ': case 'touchend ': case 'touchmove ': {
844
+ case 'touchstart ':
845
+ case 'touchend ':
846
+ case 'touchmove ': {
838
847
Browser . calculateMouseEvent ( event ) ;
839
848
break ;
840
849
}
841
- case 'keydown ': case 'keyup ': {
850
+ case 'keydown ':
851
+ case 'keyup ': {
842
852
var down = event . type === 'keydown' ;
843
853
var code = SDL . lookupKeyCodeForEvent ( event ) ;
844
854
#if ! SAFE_HEAP
@@ -863,7 +873,8 @@ var LibrarySDL = {
863
873
864
874
break ;
865
875
}
866
- case 'mousedown' : case 'mouseup ':
876
+ case 'mousedown' :
877
+ case 'mouseup ':
867
878
if ( event . type == 'mousedown' ) {
868
879
// SDL_BUTTON(x) is defined as (1 << ((x)-1)). SDL buttons are 1-3,
869
880
// and DOM buttons are 0-2, so this means that the below formula is
@@ -1478,11 +1489,7 @@ var LibrarySDL = {
1478
1489
SDL . addedResizeListener = true ;
1479
1490
Browser . resizeListeners . push ( ( w , h ) => {
1480
1491
if ( ! SDL . settingVideoMode ) {
1481
- SDL . receiveEvent ( {
1482
- type : 'resize' ,
1483
- w,
1484
- h
1485
- } ) ;
1492
+ SDL . receiveEvent ( { type : 'resize' , w, h } ) ;
1486
1493
}
1487
1494
} ) ;
1488
1495
}
0 commit comments