Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
Fix status bar translation bug, orientation set bug, and bar fill bug
Browse files Browse the repository at this point in the history
  • Loading branch information
brittyazel committed Feb 2, 2019
1 parent 7e15518 commit 1acafb3
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 36 deletions.
4 changes: 2 additions & 2 deletions Neuron-GUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4116,10 +4116,10 @@ local sbadjOptions = {

[1] = { "WIDTH", L["Width"], 1, "UpdateWidth", 0.5, 1, nil, nil, "%0.1f", 1, "" },
[2] = { "HEIGHT", L["Height"], 1, "UpdateHeight", 0.5, 1, nil, nil, "%0.1f", 1, "" },
[3] = { "BARFILL", L["Bar Fill"], 2, "UpdateNormalTexture", nil, nil, nil, BarTexturesData },
[3] = { "BARFILL", L["Bar Fill"], 2, "UpdateBarFill", nil, nil, nil, BarTexturesData },
[4] = { "BORDER", L["Border"], 2, "UpdateBorder", nil, nil, nil, BarBordersData },
[5] = { "ORIENT", L["Orientation"], 2, "UpdateOrientation", nil, nil, nil, Neuron.BarOrientations },
[6] = { "UNIT_WATCH", L["Unit"], 2, "UpdateUnit", nil, nil, nil, Neuron.BarUnits },
[6] = { "UNIT_WATCH", L["Unit"], 2, "UpdateUnit", nil, nil, nil, Neuron.BarUnits },
[7] = { "CENTER_TEXT", L["Center Text"], 2, "UpdateCenterText", nil, nil, nil, Neuron.sbStrings },
[8] = { "LEFT_TEXT", L["Left Text"], 2, "UpdateLeftText", nil, nil, nil, Neuron.sbStrings },
[9] = { "RIGHT_TEXT", L["Right Text"], 2, "UpdateRightText", nil, nil, nil, Neuron.sbStrings },
Expand Down
75 changes: 41 additions & 34 deletions Objects/STATUSBTN.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ local BarBorders = {
Neuron.BarBorders = BarBorders

local BarOrientations = {
[1] = L["Horizontal"],
[2] = L["Vertical"],
[1] = "Horizontal",
[2] = "Vertical",
}
Neuron.BarOrientations = BarOrientations

Expand Down Expand Up @@ -1335,7 +1335,7 @@ end



function STATUSBTN:UpdateTexture(command, gui, query, skipupdate)
function STATUSBTN:UpdateBarFill(command, gui, query, skipupdate)

if (query) then
return BarTextures[self.config.texture][3]
Expand Down Expand Up @@ -1385,52 +1385,59 @@ end



function STATUSBTN:UpdateOrientation(command, gui, query, skipupdate)
function STATUSBTN:UpdateOrientation(orientationIndex, gui, query, skipupdate)

if (query) then
return BarOrientations[self.config.orientation]
end

local index = tonumber(command)
orientationIndex = tonumber(orientationIndex)

if (index) then
if (orientationIndex) then

self.config.orientation = index
self.sb.orientation = self.config.orientation
--only update if we're changing, not staying the same
if self.config.orientation ~= orientationIndex then

self.sb:SetOrientation(BarOrientations[self.config.orientation]:upper())
self.fbframe.feedback:SetOrientation(BarOrientations[self.config.orientation]:upper())
self.config.orientation = orientationIndex
self.sb.orientation = self.config.orientation

if (self.config.orientation == 2) then
self.sb.cText:SetAlpha(0)
self.sb.lText:SetAlpha(0)
self.sb.rText:SetAlpha(0)
self.sb.mText:SetAlpha(0)
else
self.sb.cText:SetAlpha(1)
self.sb.lText:SetAlpha(1)
self.sb.rText:SetAlpha(1)
self.sb.mText:SetAlpha(1)
end
self.sb:SetOrientation(BarOrientations[self.config.orientation]:lower())
self.fbframe.feedback:SetOrientation(BarOrientations[self.config.orientation]:lower())

local width, height = self.config.width, self.config.height
if (self.config.orientation == 2) then
self.sb.cText:SetAlpha(0)
self.sb.lText:SetAlpha(0)
self.sb.rText:SetAlpha(0)
self.sb.mText:SetAlpha(0)
else
self.sb.cText:SetAlpha(1)
self.sb.lText:SetAlpha(1)
self.sb.rText:SetAlpha(1)
self.sb.mText:SetAlpha(1)
end

self.config.width = height
self.config.height = width

self:SetWidth(self.config.width)
local newWidth = self.config.height
local newHeight = self.config.width

self:SetHeight(self.config.height)
self.config.height = newHeight
self.config.width = newWidth

self.bar:SetObjectLoc()
self:SetWidth(self.config.width)

self.bar:SetPerimeter()
self:SetHeight(self.config.height)

self.bar:SetSize()
self.bar:SetObjectLoc()

self.bar:SetPerimeter()

self.bar:SetSize()

if (not skipupdate) then
Neuron.NeuronGUI:Status_UpdateEditor()
self.bar:Update()
end

if (not skipupdate) then
Neuron.NeuronGUI:Status_UpdateEditor()
self.bar:Update()
end
end
end
Expand Down Expand Up @@ -1727,8 +1734,8 @@ function STATUSBTN:SetData(bar)
self.sb.failColor = { (";"):split(self.config.failColor) }

self.sb.orientation = self.config.orientation
self.sb:SetOrientation(BarOrientations[self.config.orientation]:upper())
self.fbframe.feedback:SetOrientation(BarOrientations[self.config.orientation]:upper())
self.sb:SetOrientation(BarOrientations[self.config.orientation]:lower())
self.fbframe.feedback:SetOrientation(BarOrientations[self.config.orientation]:lower())

if (self.config.orientation == 2) then
self.sb.cText:SetAlpha(0)
Expand Down

0 comments on commit 1acafb3

Please sign in to comment.