Skip to content

Commit

Permalink
Changed color update to a button press instead of ui close
Browse files Browse the repository at this point in the history
  • Loading branch information
LiuJonathan committed Nov 15, 2019
1 parent db07002 commit 1ed2cbe
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions HealComm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,6 @@ local options = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer)
options.name = "HealComm"
options:Hide()

--Refresh hard settings on config close
options:SetScript("OnHide", function(self)
HealComm:UpdateBars()
end)

options:SetScript("OnShow", function(self)

local function BoxConstructor(name, desc, clickFunc)
Expand Down Expand Up @@ -364,33 +359,39 @@ options:SetScript("OnShow", function(self)
colorLabel:SetText("Heal Color:")
colorLabel:SetPoint("TOPLEFT", timeframeSlider, "BOTTOMLEFT", 0, -36)

local redSlider = SliderConstructor("Red", "What color to make the heal bars. Update will happen after settings are closed", function(self, value) HealCommSettings.healColor.red = value/255 end)
local redSlider = SliderConstructor("Red", "What color to make the heal bars", function(self, value) HealCommSettings.healColor.red = value/255 end)
redSlider:SetMinMaxValues(0, 255)
redSlider:SetValueStep(1)
redSlider:SetObeyStepOnDrag(true)
redSlider:SetValue(HealCommSettings.healColor.red)
redSlider:SetPoint("TOPLEFT", colorLabel, "BOTTOMLEFT", 0, -26)

local greenSlider = SliderConstructor("Green", "What color to make the heal bars. Update will happen after settings are closed", function(self, value) HealCommSettings.healColor.green = value/255 end)
local greenSlider = SliderConstructor("Green", "What color to make the heal bars", function(self, value) HealCommSettings.healColor.green = value/255 end)
greenSlider:SetMinMaxValues(0, 255)
greenSlider:SetValueStep(1)
greenSlider:SetObeyStepOnDrag(true)
greenSlider:SetValue(HealCommSettings.healColor.green)
greenSlider:SetPoint("TOPLEFT", redSlider, "BOTTOMLEFT", 0, -26)

local blueSlider = SliderConstructor("Blue", "What color to make the heal bars. Update will happen after settings are closed", function(self, value) HealCommSettings.healColor.blue = value/255 end)
local blueSlider = SliderConstructor("Blue", "What color to make the heal bars", function(self, value) HealCommSettings.healColor.blue = value/255 end)
blueSlider:SetMinMaxValues(0, 255)
blueSlider:SetValueStep(1)
blueSlider:SetObeyStepOnDrag(true)
blueSlider:SetValue(HealCommSettings.healColor.blue)
blueSlider:SetPoint("TOPLEFT", greenSlider, "BOTTOMLEFT", 0, -26)

local alphaSlider = SliderConstructor("Alpha", "What color to make the heal bars. Update will happen after settings are closed", function(self, value) HealCommSettings.healColor.alpha = value/100 end)
local alphaSlider = SliderConstructor("Alpha", "What color to make the heal bars", function(self, value) HealCommSettings.healColor.alpha = value/100 end)
alphaSlider:SetMinMaxValues(0, 100)
alphaSlider:SetValueStep(1)
alphaSlider:SetObeyStepOnDrag(true)
alphaSlider:SetValue(HealCommSettings.healColor.alpha*100)
alphaSlider:SetPoint("TOPLEFT", blueSlider, "BOTTOMLEFT", 0, -26)

local updateColors = CreateFrame("Button", "updateHealColor", options, "UIPanelButtonTemplate")
updateColors:SetSize(80 ,22)
updateColors:SetText("Update")
updateColors:SetPoint("TOPLEFT", alphaSlider, "BOTTOMLEFT", 0, -22)
updateColors:SetScript("OnClick",function()HealComm:UpdateBars end)

self:SetScript("OnShow", nil)
end)
Expand Down

0 comments on commit 1ed2cbe

Please sign in to comment.