From a8ca43c996fc0d03c15ea3193ddc97298a07da77 Mon Sep 17 00:00:00 2001 From: Jason Greer Date: Tue, 6 Feb 2024 14:33:31 -0500 Subject: [PATCH] fix slider rendering --- changelog.md | 5 +++++ tullaRange_Config/widgets/colorSelector.lua | 24 ++++++++++----------- tullaRange_Config/widgets/slider.lua | 9 +++++++- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/changelog.md b/changelog.md index c81f90e..1ae1437 100644 --- a/changelog.md +++ b/changelog.md @@ -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 diff --git a/tullaRange_Config/widgets/colorSelector.lua b/tullaRange_Config/widgets/colorSelector.lua index 6d8441d..809845c 100644 --- a/tullaRange_Config/widgets/colorSelector.lua +++ b/tullaRange_Config/widgets/colorSelector.lua @@ -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') @@ -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) diff --git a/tullaRange_Config/widgets/slider.lua b/tullaRange_Config/widgets/slider.lua index 1af9513..706f78b 100644 --- a/tullaRange_Config/widgets/slider.lua +++ b/tullaRange_Config/widgets/slider.lua @@ -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)