diff options
| author | RblSb <msrblsb@gmail.com> | 2021-08-28 01:09:18 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2021-08-28 01:09:18 +0300 |
| commit | e2c76dece4ba9daf1dcce338026339c17c9bd6cd (patch) | |
| tree | d0e61c8c297c6cc5d440e8f8112956dfbcadef94 /src/client/Buttons.hx | |
| parent | 8c0b2edaa6c07f8f6ac4970059ff8964c8630a4a (diff) | |
iOS...
Sent from my iPhone
Diffstat (limited to 'src/client/Buttons.hx')
| -rw-r--r-- | src/client/Buttons.hx | 28 |
1 files changed, 26 insertions, 2 deletions
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; }); } |
