/Tukui/modules/chat/mousescroll.lua

http://github.com/Asphyxia/Tukui · Lua · 27 lines · 22 code · 2 blank · 3 comment · 8 complexity · 34c1c9a5e2156d98cbb8108535b0f457 MD5 · raw file

  1. local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
  2. if C["chat"].enable ~= true then return end
  3. ------------------------------------------------------------------------
  4. -- Enhance/rewrite a Blizzard feature, chatframe mousewheel.
  5. ------------------------------------------------------------------------
  6. local ScrollLines = 3 -- set the jump when a scroll is done !
  7. function FloatingChatFrame_OnMouseScroll(self, delta)
  8. if delta < 0 then
  9. if IsShiftKeyDown() then
  10. self:ScrollToBottom()
  11. else
  12. for i = 1, ScrollLines do
  13. self:ScrollDown()
  14. end
  15. end
  16. elseif delta > 0 then
  17. if IsShiftKeyDown() then
  18. self:ScrollToTop()
  19. else
  20. for i = 1, ScrollLines do
  21. self:ScrollUp()
  22. end
  23. end
  24. end
  25. end