From a1b7ec16b3cfb9e4ac0f61ed74269416cd63475a Mon Sep 17 00:00:00 2001 From: David Skoland Date: Thu, 23 Nov 2023 19:58:55 +0100 Subject: Hide chatbox on blankposts --- webAO/packets/handlers/handleMS.ts | 2 ++ webAO/viewport/utils/handleICSpeaking.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/webAO/packets/handlers/handleMS.ts b/webAO/packets/handlers/handleMS.ts index 894db3b..1c30d55 100644 --- a/webAO/packets/handlers/handleMS.ts +++ b/webAO/packets/handlers/handleMS.ts @@ -159,6 +159,8 @@ export const handleMS = (args: string[]) => { if (chatmsg.content.trim() === "") { //blankpost chatmsg.content = ""; + // empty string as chatbox means hide it + chatmsg.chatbox = ""; } // our own message appeared, reset the buttons diff --git a/webAO/viewport/utils/handleICSpeaking.ts b/webAO/viewport/utils/handleICSpeaking.ts index e2b8a29..4fe68d3 100644 --- a/webAO/viewport/utils/handleICSpeaking.ts +++ b/webAO/viewport/utils/handleICSpeaking.ts @@ -213,6 +213,10 @@ export const handle_ic_speaking = async (playerChatMsg: ChatMsg) => { setChatbox(client.viewport.getChatmsg().chatbox); resizeChatbox(); + if (client.viewport.getChatmsg().chatbox === "") { + // No chatbox means hide it + chatContainerBox.style.opacity = "0"; + } if (!skipoffset) { // Flip the character -- cgit