/
local function updateBarsFrameLevel(bartupd) |
if not bartupd then return false end |
local j, t |
-- simple bubble sort |
local n=1 |
while bartupd[n] do n=n+1 end; n=n-1 |
qsort(bartupd, 1, n, function(x, y) return (x.start+x.dur) <= (y.start + y.dur) end) |
end |
end |
end |
local function changeFrameAlpha(bars) |
if not bars or #bars <= 1 then return end |
local maxfl = #bars + 2 |
for _, bar in pairs(bars) do |
if not bar.oldalpha then |
bar.oldalpha = bar.frame:GetAlpha() |
bar.frame:SetAlpha(bar.frame:GetAlpha() * 0.5) |
end |
end |
end |
-- check is relative to the scale |
local function checkDistance(f1, f2) |
if scaleinfo.horizontal then |
local pos1 = f1:GetHeight() + f1:GetLeft() |
local pos2 = f2:GetHeight() + f2:GetLeft() |
local pos1 = f1:GetWidth() + f1:GetLeft() |
local pos2 = f2:GetWidth() + f2:GetLeft() |
return math.abs(pos1 - pos2) |
else |
local pos1 = f1:GetTop() |
local pos2 = f2:GetTop() |
DEFAULT_CHAT_FRAME:AddMessage(pos1) |
DEFAULT_CHAT_FRAME:AddMessage(pos2) |
return math.abs(pos1 - pos2) |
end |
end |
local function resetAlpha() |
for _, bar in pairs(bars) do |
if bar.oldalpha then |
bar.frame:SetAlpha(bar.oldalpha) |
bar.oldalpha = nil |
end |
end |
end |
local function overlapRotate() |
if not bars or #bars == 0 then return end |
-- |
resetAlpha() |
-- |
for i = 0, 10 do -- go through every position |
local tab = newList() |
local first = true |
for _, bar in pairs(bars) do |
if bar.pos and bar.pos == i then |
table.insert(tab, bar) |
table.insert(tab, bar) |
end |
end |
for _, barcheck in pairs(tab) do |
if barcheck ~= bar then |
if checkDistance(bar.frame, barcheck.frame) < 5 then |
DEFAULT_CHAT_FRAME:AddMessage(checkDistance(bar.frame, barcheck.frame)) |
tinsert(ftab, barcheck) |
end |
end |
end |
if #ftab > 1 then |
DEFAULT_CHAT_FRAME:AddMessage(#ftab.."test") |
changeFrameLevel(ftab) |
if #ftab > 1 then |
--changeFrameLevel(ftab) |
changeFrameAlpha(ftab) |
end |
ftab = nil |
end |
OnVerticalUpdate(bars, el, scaleinfo.maxneg, scaleinfo.maxtime, scaleinfo.loflag) |
end |
if overlap >= 0.4 then |
--overlapRotate() |
overlapRotate() |
overlap = 0 |
sbar:UpdateFrameLevel() |
end |
scaleinfo.amaxtimes = deepCopy(amaxtimes) |
scaleinfo.iconpos = iconpos |
scaleinfo.hide = hide |
DEFAULT_CHAT_FRAME:AddMessage("WHAT THE FUCK") |
if horizontal then |
scaleinfo.frame = createHorizontalScale(size, maxtime, steps, savepos, loflag, texture) |
else |
scaleinfo.frame = createVericalScale(size, maxtime, steps, savepos, loflag, texture) |
end |
DEFAULT_CHAT_FRAME:AddMessage("WHAT THE FUCK TEST") |
if not scaleinfo.frame then DEFAULT_CHAT_FRAME:AddMessage("suck it") |
else |
DEFAULT_CHAT_FRAME:AddMessage("suck i123123t") |
end |
scaleinfo.frame:SetScale(scale) |
scaleinfo.horizontal = horizontal |
scaleinfo.size = size |