From 5b94c5cc110f9367b844a622aa0ef4aabef34750 Mon Sep 17 00:00:00 2001 From: RblSb Date: Sat, 23 May 2020 22:33:44 +0300 Subject: Scroll to chat end on input touch --- src/client/Buttons.hx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/client/Buttons.hx') 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: { -- cgit v1.2.3