[view] fix InputView text update on input
This commit is contained in:
@@ -20,7 +20,7 @@ class InputView extends TextView {
|
|||||||
super();
|
super();
|
||||||
textField.type = TextFieldType.INPUT;
|
textField.type = TextFieldType.INPUT;
|
||||||
textField.addEventListener(Event.CHANGE, onTextChange);
|
textField.addEventListener(Event.CHANGE, onTextChange);
|
||||||
textField.addEventListener(KeyboardEvent.KEY_UP, _onKeyUp);
|
textField.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
|
||||||
textField.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
|
textField.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
|
||||||
|
|
||||||
hintTextField = buildHintTextField();
|
hintTextField = buildHintTextField();
|
||||||
@@ -50,9 +50,10 @@ class InputView extends TextView {
|
|||||||
hintTextField.visible = (textField.text == "");
|
hintTextField.visible = (textField.text == "");
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _onKeyUp(event:KeyboardEvent):Void {
|
private function onKeyUp(event:KeyboardEvent):Void {
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
onChange.emit(textField.text);
|
_text = textField.text;
|
||||||
|
onChange.emit(_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function onKeyDown(event:KeyboardEvent):Void {
|
private function onKeyDown(event:KeyboardEvent):Void {
|
||||||
@@ -71,7 +72,7 @@ class InputView extends TextView {
|
|||||||
|
|
||||||
public function dispose():Void {
|
public function dispose():Void {
|
||||||
textField.removeEventListener(Event.CHANGE, onTextChange);
|
textField.removeEventListener(Event.CHANGE, onTextChange);
|
||||||
textField.removeEventListener(KeyboardEvent.KEY_UP, _onKeyUp);
|
textField.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);
|
||||||
textField.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
|
textField.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user