From e2c76dece4ba9daf1dcce338026339c17c9bd6cd Mon Sep 17 00:00:00 2001 From: RblSb Date: Sat, 28 Aug 2021 01:09:18 +0300 Subject: iOS... Sent from my iPhone --- src/client/Buttons.hx | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/client/Buttons.hx') diff --git a/src/client/Buttons.hx b/src/client/Buttons.hx index aba629e..b11e3fd 100644 --- a/src/client/Buttons.hx +++ b/src/client/Buttons.hx @@ -335,7 +335,10 @@ class Buttons { static function initChatInput(main:Main):Void { final guestName:InputElement = cast ge("#guestname"); guestName.onkeydown = e -> { - if (e.keyCode == KeyCode.Return) main.guestLogin(guestName.value); + if (e.keyCode == KeyCode.Return) { + main.guestLogin(guestName.value); + if (Utils.isTouch()) guestName.blur(); + } } final guestPass:InputElement = cast ge("#guestpass"); @@ -343,12 +346,32 @@ class Buttons { if (e.keyCode == KeyCode.Return) { main.userLogin(guestName.value, guestPass.value); guestPass.value = ""; + if (Utils.isTouch()) guestPass.blur(); } } + if (Utils.isIOS()) { + document.ontouchmove = e -> { + e.preventDefault(); + } + ge("#chat").style.height = "-webkit-fill-available"; + } final chatline:InputElement = cast ge("#chatline"); chatline.onfocus = e -> { - if (Utils.isTouch()) main.scrollChatToEnd(); + if (Utils.isIOS()) { + var startY = window.scrollY; + Timer.delay(() -> { + window.scrollBy(0, -(window.scrollY - startY)); + ge("#chat").style.height = '${window.innerHeight}px'; + ge("#video").scrollTop = 0; + main.scrollChatToEnd(); + }, 100); + } else if (Utils.isTouch()) main.scrollChatToEnd(); + } + chatline.onblur = e -> { + if (Utils.isIOS()) { + ge("#chat").style.height = "-webkit-fill-available"; + } } new InputWithHistory(chatline, 50, value -> { if (main.handleCommands(value)) return true; @@ -359,6 +382,7 @@ class Buttons { text: value } }); + if (Utils.isTouch()) chatline.blur(); return true; }); } -- cgit v1.2.3