Skip to content

Commit

Permalink
fix slider rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuller committed Feb 6, 2024
1 parent a2ad08a commit a8ca43c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# tullaRange release notes

## 10.2.3

* Update TOCs for 1.15.1
* Fixed an issue causing the options menu sliders to not render properly in Classic

## 10.2.2

* Update TOCs for 10.2.5
Expand Down
24 changes: 11 additions & 13 deletions tullaRange_Config/widgets/colorSelector.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local _, Addon = ...

local L = Addon.L
local tullaRange = _G.tullaRange
local ColorChannels = {'Red', 'Green', 'Blue', 'Opacity'}
local ColorChannels = { 'Red', 'Green', 'Blue', 'Opacity' }

local ColorSelector = Addon:NewWidgetTemplate('Frame')

Expand Down Expand Up @@ -87,25 +87,23 @@ function ColorSelector:New(state, parent)
end

do
local spellIcons = {}
local SpellIcons = {}

-- generate spell icons
do
for i = 1, GetNumSpellTabs() do
local offset, numSpells = select(3, GetSpellTabInfo(i))
local tabEnd = offset + numSpells

for j = offset, tabEnd - 1 do
local texture = GetSpellBookItemTexture(j, 'player')
if texture then
table.insert(spellIcons, texture)
end
for i = 1, GetNumSpellTabs() do
local _, _, offset, numSlots = GetSpellTabInfo(i)
local tabEnd = offset + numSlots

for j = offset, tabEnd - 1 do
local texture = GetSpellBookItemTexture(j, 'player')
if texture then
SpellIcons[#SpellIcons + 1] = texture
end
end
end

function ColorSelector:UpdateValues()
local texture = spellIcons[math.random(1, #spellIcons)]
local texture = SpellIcons[math.random(1, #SpellIcons)]

self.PreviewIcon:SetTexture(texture)

Expand Down
9 changes: 8 additions & 1 deletion tullaRange_Config/widgets/slider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ local _, Addon = ...

local Slider = Addon:NewWidgetTemplate('Slider')

local SLIDER_TEMPLATE_NAME
if LE_EXPANSION_LEVEL_CURRENT <= LE_EXPANSION_WRATH_OF_THE_LICH_KING then
SLIDER_TEMPLATE_NAME = "HorizontalSliderTemplate"
else
SLIDER_TEMPLATE_NAME = "UISliderTemplate"
end

function Slider:New(name, parent, low, high, step)
local slider = self:Bind(CreateFrame('Slider', nil, parent, 'UISliderTemplate'))
local slider = self:Bind(CreateFrame('Slider', nil, parent, SLIDER_TEMPLATE_NAME))

slider:SetSize(144, 17)
slider:SetMinMaxValues(low, high)
Expand Down

0 comments on commit a8ca43c

Please sign in to comment.