diff --git a/TomTomLite.lua b/TomTomLite.lua
index cc3afb2..3f858dc 100644
--- a/TomTomLite.lua
+++ b/TomTomLite.lua
@@ -48,11 +48,11 @@ function addon:CreateCrazyArrow(name, parent)
local perc = math.abs((math.pi - math.abs(faceangle)) / math.pi)
local gr,gg,gb = unpack(addon.db.profile.goodcolor)
- local mr,mg,mb = unpack(addon.db.profile.middlecolor)
- local br,bg,bb = unpack(addon.db.profile.badcolor)
- local r,g,b = addon:ColorGradient(perc, br, bg, bb, mr, mg, mb, gr, gg, gb)
+ local mr,mg,mb = unpack(addon.db.profile.middlecolor)
+ local br,bg,bb = unpack(addon.db.profile.badcolor)
+ local r,g,b = addon:ColorGradient(perc, br, bg, bb, mr, mg, mb, gr, gg, gb)
- self.arrow:SetVertexColor(r,g,b)
+ self.arrow:SetVertexColor(r,g,b)
self.arrow:SetRotation(faceangle)
self.subtitle:SetFormattedText("%.1f yards", distance)
@@ -67,7 +67,7 @@ function addon:CreateCrazyArrow(name, parent)
self:StopMovingOrSizing()
addon:SavePosition(self)
end)
- frame:SetScript("OnHide", frame:GetScript("OnDragStop"))
+ frame:SetScript("OnHide", frame:GetScript("OnDragStop"))
self:RestorePosition(frame)
return frame
diff --git a/Utils.lua b/Utils.lua
index fc66ed2..44179cc 100644
--- a/Utils.lua
+++ b/Utils.lua
@@ -2,66 +2,66 @@ local addonName, addon = ...
local L = addon.L
function addon:ColorGradient(perc, ...)
- local num = select("#", ...)
- local hexes = type(select(1, ...)) == "string"
+ local num = select("#", ...)
+ local hexes = type(select(1, ...)) == "string"
- if perc == 1 then
- return select(num-2, ...), select(num-1, ...), select(num, ...)
- end
+ if perc == 1 then
+ return select(num-2, ...), select(num-1, ...), select(num, ...)
+ end
- num = num / 3
+ num = num / 3
- local segment, relperc = math.modf(perc*(num-1))
- local r1, g1, b1, r2, g2, b2
- r1, g1, b1 = select((segment*3)+1, ...), select((segment*3)+2, ...), select((segment*3)+3, ...)
- r2, g2, b2 = select((segment*3)+4, ...), select((segment*3)+5, ...), select((segment*3)+6, ...)
+ local segment, relperc = math.modf(perc*(num-1))
+ local r1, g1, b1, r2, g2, b2
+ r1, g1, b1 = select((segment*3)+1, ...), select((segment*3)+2, ...), select((segment*3)+3, ...)
+ r2, g2, b2 = select((segment*3)+4, ...), select((segment*3)+5, ...), select((segment*3)+6, ...)
- if not r2 or not g2 or not b2 then
- return r1, g1, b1
- else
- return r1 + (r2-r1)*relperc,
- g1 + (g2-g1)*relperc,
- b1 + (b2-b1)*relperc
- end
+ if not r2 or not g2 or not b2 then
+ return r1, g1, b1
+ else
+ return r1 + (r2-r1)*relperc,
+ g1 + (g2-g1)*relperc,
+ b1 + (b2-b1)*relperc
+ end
end
function addon:SavePosition(f)
local name = f:GetName()
local x,y = f:GetLeft(), f:GetTop()
local s = f:GetEffectiveScale()
-
+
x,y = x*s,y*s
-
- local opt = addon.db.profile.positions[name]
- if not opt then
- addon.db.profile.positions[name] = {}
- opt = addon.db.profile.positions[name]
- end
+
+ local opt = addon.db.profile.positions[name]
+ if not opt then
+ addon.db.profile.positions[name] = {}
+ opt = addon.db.profile.positions[name]
+ end
opt.PosX = x
opt.PosY = y
end
function addon:RestorePosition(f)
local name = f:GetName()
- local opt = addon.db.profile.positions[name]
- if not opt then
- addon.db.profile.positions[name] = {}
- opt = addon.db.profile.positions[name]
- end
+ local opt = addon.db.profile.positions[name]
+ if not opt then
+ addon.db.profile.positions[name] = {}
+ opt = addon.db.profile.positions[name]
+ end
- local x = opt.PosX
- local y = opt.PosY
+ local x = opt.PosX
+ local y = opt.PosY
local s = f:GetEffectiveScale()
-
+
if not x or not y then
f:ClearAllPoints()
f:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
- return
+ return
end
x,y = x/s,y/s
f:ClearAllPoints()
- f:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x, y)
+ f:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x, y)
end