Improve HTML5 onTextInput
This commit is contained in:
@@ -192,7 +192,7 @@ class HTML5Application {
|
||||
//}
|
||||
|
||||
var keyCode = cast convertKeyCode (event.keyCode != null ? event.keyCode : event.which);
|
||||
var modifier = (event.shiftKey ? (KeyModifier.SHIFT) : 0) | (event.ctrlKey ? (KeyModifier.CTRL) : 0) | (event.altKey ? (KeyModifier.ALT) : 0) | (event.metaKey ? (KeyModifier.META) : 0);
|
||||
var modifier = cast (event.shiftKey ? (KeyModifier.SHIFT) : 0) | (event.ctrlKey ? (KeyModifier.CTRL) : 0) | (event.altKey ? (KeyModifier.ALT) : 0) | (event.metaKey ? (KeyModifier.META) : 0);
|
||||
|
||||
if (event.type == "keydown") {
|
||||
|
||||
@@ -200,7 +200,15 @@ class HTML5Application {
|
||||
|
||||
if (parent.window.enableTextEvents) {
|
||||
|
||||
parent.window.onTextInput.dispatch (String.fromCharCode (event.keyCode));
|
||||
if (event.keyCode >= 65 && event.keyCode <= 90 && !modifier.shiftKey) {
|
||||
|
||||
parent.window.onTextInput.dispatch (String.fromCharCode (event.keyCode + 32));
|
||||
|
||||
} else {
|
||||
|
||||
parent.window.onTextInput.dispatch (String.fromCharCode (event.keyCode));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -241,5 +241,11 @@ package lime.ui;
|
||||
var EJECT = 0x40000119;
|
||||
var SLEEP = 0x4000011A;
|
||||
|
||||
@:op(A > B) private static inline function gt (a:KeyCode, b:KeyCode):Bool { return (a:Int) > (b:Int); }
|
||||
@:op(A >= B) private static inline function gte (a:KeyCode, b:KeyCode):Bool { return (a:Int) >= (b:Int); }
|
||||
@:op(A < B) private static inline function lt (a:KeyCode, b:KeyCode):Bool { return (a:Int) < (b:Int); }
|
||||
@:op(A <= B) private static inline function lte (a:KeyCode, b:KeyCode):Bool { return (a:Int) <= (b:Int); }
|
||||
@:op(A + B) private static inline function plus (a:KeyCode, b:Int):KeyCode { return (a:Int) + b; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user