Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. child.deco_up = CreateFrame("Button", nil, child)
  2. child.deco_up:SetPoint("TOPLEFT", child, "TOPLEFT", -4, 4)
  3. child.deco_up:SetPoint("BOTTOMRIGHT", child, "TOPRIGHT", 4, -spacing)
  4. child.deco_up:SetFrameStrata("DIALOG")
  5. child.deco_up:SetFrameLevel(128)
  6. child.deco_up:SetScript("OnClick", function()
  7. local scroll = this:GetParent()
  8. local current = scroll:GetVerticalScroll()
  9. local new = current - 25
  10. local max = scroll:GetVerticalScrollRange() + spacing
  11. if max > spacing then
  12. if new < 0 then
  13. scroll:SetVerticalScroll(0)
  14. elseif new > max then
  15. scroll:SetVerticalScroll(max)
  16. else
  17. scroll:SetVerticalScroll(new)
  18. end
  19. end
  20. scroll:UpdateScrollState()
  21. end)
  22. child.deco_up.fader = child.deco_up:CreateTexture("OVERLAY")
  23. child.deco_up.fader:SetTexture(1,1,1,1)
  24. child.deco_up.fader:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 1)
  25. child.deco_up.fader:SetAllPoints(child.deco_up)
  26.  
  27. child.deco_up_indicator = CreateFrame("Frame", nil, child.deco_up)
  28. child.deco_up_indicator:Hide()
  29. child.deco_up_indicator:SetPoint("TOP", child.deco_up, "TOP", 0, -6)
  30. child.deco_up_indicator:SetHeight(12)
  31. child.deco_up_indicator:SetWidth(12)
  32. child.deco_up_indicator.modifier = 0.03
  33. child.deco_up_indicator:SetScript("OnUpdate", function()
  34. local alpha = this:GetAlpha()
  35. if alpha >= .75 then
  36. this.modifier = -0.03
  37. elseif alpha <= .25 then
  38. this.modifier = 0.03
  39. end
  40.  
  41. this:SetAlpha(alpha + this.modifier)
  42. end)
  43.  
  44. child.deco_up_indicator.tex = child.deco_up_indicator:CreateTexture("OVERLAY")
  45. child.deco_up_indicator.tex:SetTexture("Interface\\AddOns\\pfUI\\img\\up")
  46. child.deco_up_indicator.tex:SetAllPoints(child.deco_up_indicator)
  47.  
  48. child.deco_down = CreateFrame("Button", nil, child)
  49. child.deco_down:SetPoint("BOTTOMLEFT", child, "BOTTOMLEFT", -4, -4)
  50. child.deco_down:SetPoint("TOPRIGHT", child, "BOTTOMRIGHT", 4, spacing)
  51. child.deco_down:SetFrameStrata("DIALOG")
  52. child.deco_down:SetFrameLevel(128)
  53. child.deco_down:SetScript("OnClick", function()
  54. local scroll = this:GetParent()
  55. local current = scroll:GetVerticalScroll()
  56. local new = current + 25
  57. local max = scroll:GetVerticalScrollRange() + spacing
  58. if max > spacing then
  59. if new < 0 then
  60. scroll:SetVerticalScroll(0)
  61. elseif new > max then
  62. scroll:SetVerticalScroll(max)
  63. else
  64. scroll:SetVerticalScroll(new)
  65. end
  66. end
  67. scroll:UpdateScrollState()
  68. end)
  69. child.deco_down.fader = child.deco_down:CreateTexture("OVERLAY")
  70. child.deco_down.fader:SetTexture(1,1,1,1)
  71. child.deco_down.fader:SetGradientAlpha("VERTICAL", 0, 0, 0, 1, 0, 0, 0, 0)
  72. child.deco_down.fader:SetAllPoints(child.deco_down)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement