Explorar o código

Fixed game-related key propagation issue (#692)

Sébastien Bénard %!s(int64=5) %!d(string=hai) anos
pai
achega
10b6294dbb
Modificáronse 1 ficheiros con 10 adicións e 1 borrados
  1. 10 1
      hxd/Window.js.hx

+ 10 - 1
hxd/Window.js.hx

@@ -296,7 +296,16 @@ class Window {
 		ev.keyCode = e.keyCode;
 		event(ev);
 		if( !propagateKeyEvents ) {
-			//e.preventDefault() -- required to trigger onKeyPress
+			switch ev.keyCode {
+				case 37, 38, 39, 40, // Arrows
+					33, 34, // Page up/down
+					35, 36, // Home/end
+					8, // Backspace
+					16, // Shift
+					17 : // Ctrl
+						e.preventDefault();
+				case _ :
+			}
 			e.stopPropagation();
 		}
 	}