Allow mouse wheel for chat history scroll

This commit is contained in:
Vortrex
2022-03-21 23:55:35 -05:00
parent 2412e4a542
commit ba50a90e20
2 changed files with 35 additions and 0 deletions

View File

@@ -107,4 +107,19 @@ function updateChatBox() {
}
}
// ===========================================================================
function processMouseWheelForChatBox(up) {
// 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();
} else {
chatBoxScrollDown()
}
}
// ===========================================================================

View File

@@ -51,6 +51,8 @@ function addAllEventHandlers() {
addEventHandler("OnFocus", onFocus);
addEventHandler("OnCameraProcess", onCameraProcess);
addEventHandler("OnMouseWheel", onMouseWheel);
}
// ===========================================================================
@@ -231,4 +233,22 @@ function onChatOutput(event, messageText, colour) {
//receiveChatBoxMessageFromServer(messageText, colour);
}
// ===========================================================================
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);
}
}
}
// ===========================================================================