diff options
| author | RblSb <msrblsb@gmail.com> | 2020-05-23 22:33:44 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2020-05-23 22:33:44 +0300 |
| commit | 5b94c5cc110f9367b844a622aa0ef4aabef34750 (patch) | |
| tree | 495d14c2041959fe859957fb9ab96d80fffa03be /src/client/Buttons.hx | |
| parent | 45080aa1f6d80f2ef64983904acbe1645c312d25 (diff) | |
Scroll to chat end on input touch
Diffstat (limited to 'src/client/Buttons.hx')
| -rw-r--r-- | src/client/Buttons.hx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/client/Buttons.hx b/src/client/Buttons.hx index 625a71f..7e9c8cb 100644 --- a/src/client/Buttons.hx +++ b/src/client/Buttons.hx @@ -297,18 +297,22 @@ class Buttons { static function initChatInput(main:Main):Void { final guestName:InputElement = cast ge("#guestname"); guestName.onkeydown = e -> { - if (e.keyCode == 13) main.guestLogin(guestName.value); + if (e.keyCode == KeyCode.Return) main.guestLogin(guestName.value); } final guestPass:InputElement = cast ge("#guestpass"); guestPass.onkeydown = e -> { - if (e.keyCode == 13) { + if (e.keyCode == KeyCode.Return) { main.userLogin(guestName.value, guestPass.value); guestPass.value = ""; } } - new InputWithHistory(cast ge("#chatline"), 50, value -> { + final chatline:InputElement = cast ge("#chatline"); + chatline.onfocus = e -> { + if (Utils.isTouch()) main.scrollChatToEnd(); + } + new InputWithHistory(chatline, 50, value -> { main.send({ type: Message, message: { |
