From f634cb82473d2f7ab544d3a561d50aeda04e8154 Mon Sep 17 00:00:00 2001 From: Eyal Shilony Date: Mon, 17 Nov 2014 05:52:37 +0200 Subject: [PATCH] The icon and timer should no longer overlap when they are positioned in the same direction. The total time should be displayed correctly in all positions. The timer appears on top of the castingbar for Inner Left/Right position so the name of the spell will not overlap the timer. --- CastingBar.lua | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/CastingBar.lua b/CastingBar.lua index 587d50a..bede0a5 100644 --- a/CastingBar.lua +++ b/CastingBar.lua @@ -68,12 +68,25 @@ local function updateVisibility(source, ...) end end -local function setFeaturesPosition(frame, position) +local function setIconAndTimePositions(frame, position) frame:ClearAllPoints() + + local parent, x, y = castingBar.frame, -10, 3 + + if position:find("Inner") then + x, y = addon.db.profile.hideTotalTime and 30 or 60, 20 + elseif not addon.db.profile.hideIcon then + local isTime = frame == parent.time + local isPosEqual = addon.db.profile.timePosition:find(addon.db.profile.iconPosition) + if isTime and isPosEqual then + parent, x, y = parent.icon, -5, 0 + end + end + if position:find("Left") then - frame:SetPoint("RIGHT", castingBar.frame, "LEFT", position:find("Inner") and 25 or -10, 3) + frame:SetPoint("RIGHT", parent, "LEFT", x, y) elseif position:find("Right") then - frame:SetPoint("LEFT", castingBar.frame, "RIGHT", position:find("Inner") and -25 or 10, 3) + frame:SetPoint("LEFT", parent, "RIGHT", x * -1, y) end end @@ -104,13 +117,13 @@ local function onEvent(self, event, ...) end if texture and not addon.db.profile.hideIcon then self.icon:SetTexture(texture) - setFeaturesPosition(self.icon, addon.db.profile.iconPosition) + setIconAndTimePositions(self.icon, addon.db.profile.iconPosition) self.icon:Show() else self.icon:Hide() end if not addon.db.profile.hideTime then - setFeaturesPosition(self.time, addon.db.profile.timePosition) + setIconAndTimePositions(self.time, addon.db.profile.timePosition) self.time:Show() else self.time:Hide() @@ -129,7 +142,7 @@ local function onUpdate(self, elapsed) if self.casting then local value = self.maxValue - self.value if not addon.db.profile.hideTotalTime then - self.time:SetFormattedText("%.1f/%.2f", value, self.maxValue) + self.time:SetFormattedText("%.1f/%.1f", value, self.maxValue) else self.time:SetFormattedText("%.1f", value) end -- 1.7.9.5