Merge branch 'master' of bitbucket.org:shmyga/haxework

This commit is contained in:
2019-06-18 17:07:59 +03:00
2 changed files with 4 additions and 3 deletions

View File

@@ -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,7 +50,7 @@ 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();
_text = textField.text; _text = textField.text;
onChange.emit(_text); onChange.emit(_text);
@@ -72,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);
} }
} }

View File

@@ -58,6 +58,7 @@ class ScrollView extends HGroupView {
private function set_position(value:Float):Float { private function set_position(value:Float):Float {
position = Math.min(Math.max(0, value), 1 - (height / view.height)); position = Math.min(Math.max(0, value), 1 - (height / view.height));
if (height / view.height > 1) position = 0;
if (scroll != null) { if (scroll != null) {
scroll.position = position; scroll.position = position;
} }