Allow mouse wheel for chat history scroll
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user