chat-tweaks: enable mousewheel and sticky chat

This commit is contained in:
shagu
2021-09-20 11:08:15 +02:00
parent dc73a1feef
commit 415f7574d1
3 changed files with 56 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
local _G = _G or getfenv(0)
local scrollspeed = 1
local module = ShaguTweaks:register({
title = "Chat Tweaks",
description = "Allows to scroll using the mouse wheel and enables sticky chat channels.",
enabled = true,
})
local function ChatOnMouseWheel()
if arg1 > 0 then
if IsShiftKeyDown() then
this:ScrollToTop()
else
for i=1, scrollspeed do
this:ScrollUp()
end
end
elseif arg1 < 0 then
if IsShiftKeyDown() then
this:ScrollToBottom()
else
for i=1, scrollspeed do
this:ScrollDown()
end
end
end
end
module.enable = function(self)
-- enable sticky chat types
ChatTypeInfo.WHISPER.sticky = 1
ChatTypeInfo.OFFICER.sticky = 1
ChatTypeInfo.RAID_WARNING.sticky = 1
ChatTypeInfo.CHANNEL.sticky = 1
for i=1, NUM_CHAT_WINDOWS do
-- enable mouse wheel scrolling
_G["ChatFrame" .. i]:EnableMouseWheel(true)
_G["ChatFrame" .. i]:SetScript("OnMouseWheel", ChatOnMouseWheel)
-- hide buttons
--_G["ChatFrame" .. i .. "UpButton"]:Hide()
--_G["ChatFrame" .. i .. "UpButton"].Show = function() return end
--_G["ChatFrame" .. i .. "DownButton"]:Hide()
--_G["ChatFrame" .. i .. "DownButton"].Show = function() return end
--_G["ChatFrame" .. i .. "BottomButton"]:Hide()
--_G["ChatFrame" .. i .. "BottomButton"].Show = function() return end
--_G["ChatFrameMenuButton"]:Hide()
--_G["ChatFrameMenuButton"].Show = function() return end
end
end