Commit c84c5631 authored by Simpy's avatar Simpy 🐹
Browse files

castbar text sometimes was cut off cause of some 5 year old function :)

parent bbf566fa
......@@ -47,10 +47,12 @@ function UF:Construct_Castbar(frame, moverName)
castbar.Time:SetPoint('RIGHT', castbar, 'RIGHT', -4, 0)
castbar.Time:SetTextColor(0.84, 0.75, 0.65)
castbar.Time:SetJustifyH('RIGHT')
castbar.Time:SetWidth(25)
castbar.Text = castbar:CreateFontString(nil, 'OVERLAY')
UF:Configure_FontString(castbar.Text)
castbar.Text:SetPoint('LEFT', castbar, 'LEFT', 4, 0)
castbar.Text:SetPoint('RIGHT', castbar.Time, 'LEFT', -4, 0)
castbar.Text:SetTextColor(0.84, 0.75, 0.65)
castbar.Text:SetJustifyH('LEFT')
castbar.Text:SetWordWrap(false)
......@@ -341,19 +343,9 @@ function UF:SetCastTicks(frame, numTicks, extraTickRatio)
ticks[i]:SetWidth(frame.tickWidth)
end
ticks[i]:SetHeight(frame.tickHeight)
--[[if(ms ~= 0) then
local perc = (w / frame.max) * (ms / 1e5)
if(perc > 1) then perc = 1 end
ticks[i]:SetWidth((w * perc) / (numTicks + extraTickRatio))
else
ticks[i]:SetWidth(1)
end]]
ticks[i]:ClearAllPoints()
ticks[i]:SetPoint('RIGHT', frame, 'LEFT', d * i, 0)
ticks[i]:SetHeight(frame.tickHeight)
ticks[i]:Show()
end
end
......@@ -364,37 +356,15 @@ function UF:PostCastStart(unit)
if unit == 'vehicle' then unit = 'player' end
self.unit = unit
if db.castbar.displayTarget and self.curTarget then
self.Text:SetText(self.spellName..' > '..self.curTarget)
end
-- Get length of Time, then calculate available length for Text
local timeWidth = self.Time:GetStringWidth()
local textWidth = self:GetWidth() - timeWidth - 10
local textStringWidth = self.Text:GetStringWidth()
if timeWidth == 0 or textStringWidth == 0 then
E:Delay(0.05, function() -- Delay may need tweaking
textWidth = self:GetWidth() - self.Time:GetStringWidth() - 10
textStringWidth = self.Text:GetStringWidth()
if textWidth > 0 then self.Text:SetWidth(min(textWidth, textStringWidth)) end
end)
else
self.Text:SetWidth(min(textWidth, textStringWidth))
end
self.unit = unit
if self.channeling and db.castbar.ticks and unit == 'player' then
local unitframe = E.global.unitframe
local baseTicks = unitframe.ChannelTicks[self.spellID]
---- Detect channeling spell and if it's the same as the previously channeled one
--if baseTicks and self.spellID == self.prevSpellCast then
-- self.chainChannel = true
--elseif baseTicks then
-- self.chainChannel = nil
-- self.prevSpellCast = self.spellID
--end
if baseTicks and unitframe.ChannelTicksSize[self.spellID] and unitframe.HastedChannelTicks[self.spellID] then
local tickIncRate = 1 / baseTicks
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment