From 5ebc6e8951471edc2678c2e44990552de15efd5c Mon Sep 17 00:00:00 2001 From: shagu Date: Sat, 18 Aug 2018 18:58:44 +0200 Subject: [PATCH] chat: same mousewheel function for all chats --- modules/chat.lua | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/modules/chat.lua b/modules/chat.lua index 8339d9cb..fd8825ad 100644 --- a/modules/chat.lua +++ b/modules/chat.lua @@ -337,6 +337,26 @@ pfUI:RegisterModule("chat", function () pfUI.chat:RegisterEvent("WHO_LIST_UPDATE") pfUI.chat:RegisterEvent("CHAT_MSG_SYSTEM") + local function ChatOnMouseWheel() + if (arg1 > 0) then + if IsShiftKeyDown() then + frame:ScrollToTop() + else + for i=1, C.chat.global.scrollspeed do + frame:ScrollUp() + end + end + elseif (arg1 < 0) then + if IsShiftKeyDown() then + frame:ScrollToBottom() + else + for i=1, C.chat.global.scrollspeed do + frame:ScrollDown() + end + end + end + end + function pfUI.chat:RefreshChat() local panelheight = C.global.font_size+default_border*5 @@ -436,25 +456,7 @@ pfUI:RegisterModule("chat", function () end frame:EnableMouseWheel(true) - frame:SetScript("OnMouseWheel", function() - if (arg1 > 0) then - if IsShiftKeyDown() then - frame:ScrollToTop() - else - for i=1, C.chat.global.scrollspeed do - frame:ScrollUp() - end - end - elseif (arg1 < 0) then - if IsShiftKeyDown() then - frame:ScrollToBottom() - else - for i=1, C.chat.global.scrollspeed do - frame:ScrollDown() - end - end - end - end) + frame:SetScript("OnMouseWheel", chatOnMouseWheel) end end