Browse Source

Fixed game-related key propagation issue (#692)

Sébastien Bénard 5 năm trước cách đây
mục cha
commit
10b6294dbb
1 tập tin đã thay đổi với 10 bổ sung1 xóa
  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();
 		}
 	}