From 6d2a8ee057aba742833042ca02f2f6bfc14fb37d Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Thu, 7 Apr 2022 02:04:35 -0500 Subject: [PATCH] Update mouse wheel handling to be more like other events --- scripts/client/chatbox.js | 16 ++++++++++++---- scripts/client/event.js | 14 +------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/scripts/client/chatbox.js b/scripts/client/chatbox.js index 58927751..ce5e6928 100644 --- a/scripts/client/chatbox.js +++ b/scripts/client/chatbox.js @@ -127,16 +127,24 @@ function updateChatBox() { // =========================================================================== -function processMouseWheelForChatBox(up) { +function processMouseWheelForChatBox(mouseId, deltaCoordinates, flipped) { // There isn't a way to detect whether chat input is active, but mouse cursor is forced shown when typing so ¯\_(ツ)_/¯ if(!gui.cursorEnabled) { return false; } - if(up) { - chatBoxScrollUp(); + if(!flipped) { + if(deltaCoordinates.y > 0) { + chatBoxScrollUp(); + } else { + chatBoxScrollDown(); + } } else { - chatBoxScrollDown(); + if(deltaCoordinates.y > 0) { + chatBoxScrollDown(); + } else { + chatBoxScrollUp(); + } } } diff --git a/scripts/client/event.js b/scripts/client/event.js index fabbd766..851028a7 100644 --- a/scripts/client/event.js +++ b/scripts/client/event.js @@ -232,19 +232,7 @@ function onCameraProcess(event) { // =========================================================================== function onMouseWheel(event, mouseId, deltaCoordinates, flipped) { - if(!flipped) { - if(deltaCoordinates.y > 0) { - processMouseWheelForChatBox(true); - } else { - processMouseWheelForChatBox(false); - } - } else { - if(deltaCoordinates.y > 0) { - processMouseWheelForChatBox(false); - } else { - processMouseWheelForChatBox(true); - } - } + processMouseWheelForChatBox(mouseId, deltaCoordinates, flipped); } // =========================================================================== \ No newline at end of file