Skip to content

Instantly share code, notes, and snippets.

@Meorawr
Created July 18, 2023 20:34
Show Gist options
  • Save Meorawr/878df1a37cc18326b4be2c320c61da4f to your computer and use it in GitHub Desktop.
Save Meorawr/878df1a37cc18326b4be2c320c61da4f to your computer and use it in GitHub Desktop.

Revisions

  1. Meorawr created this gist Jul 18, 2023.
    23 changes: 23 additions & 0 deletions InterpolatedScrollDemo.lua
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    local ScrollBox = CreateFrame("Frame", nil, UIParent, "WowScrollBox")
    ScrollBox:SetPoint("CENTER")
    ScrollBox:SetSize(300, 300)
    ScrollBox:SetInterpolateScroll(true)

    local ScrollBar = CreateFrame("EventFrame", nil, UIParent, "MinimalScrollBar")
    ScrollBar:SetPoint("TOPLEFT", ScrollBox, "TOPRIGHT")
    ScrollBar:SetPoint("BOTTOMLEFT", ScrollBox, "BOTTOMRIGHT")
    ScrollBar:SetInterpolateScroll(true)

    local ScrollView = CreateScrollBoxLinearView()
    ScrollView:SetPanExtent(100)

    local ScrollChild = CreateFrame("Frame", nil, ScrollBox)
    ScrollChild:SetSize(300, 1500)
    ScrollChild.scrollable = true

    local ScrollChildFill = ScrollChild:CreateTexture()
    ScrollChildFill:SetAllPoints(ScrollChild)
    ScrollChildFill:SetColorTexture(1, 1, 1, 1)
    ScrollChildFill:SetGradient("VERTICAL", CreateColor(0, 0, 0, 1), CreateColor(1, 0, 0, 1))

    ScrollUtil.InitScrollBoxWithScrollBar(ScrollBox, ScrollBar, ScrollView)