Quantcast

Tooltip option changes.

Repooc [08-16-14 - 01:58]
Tooltip option changes.
Filename
ElvUI_SLE/modules/tooltip.lua
diff --git a/ElvUI_SLE/modules/tooltip.lua b/ElvUI_SLE/modules/tooltip.lua
index 72dfd4b..0f06c73 100644
--- a/ElvUI_SLE/modules/tooltip.lua
+++ b/ElvUI_SLE/modules/tooltip.lua
@@ -2,30 +2,33 @@ local E, L, V, P, G = unpack(ElvUI);
 local TT = E:GetModule('Tooltip');

 --Defaults (Need to be moved.)
-P['tooltip']['mouseOffsetX'] = 0
-P['tooltip']['mouseOffsetY'] = 0
 P['tooltip']['overrideCombat'] = false

 local iconPath = [[Interface\AddOns\ElvUI_SLE\media\textures\]]

 local function AnchorFrameToMouse()
+	if not E.db.tooltip.cursorAnchor then return end
 	local frame = GameTooltip
 	if frame:GetAnchorType() ~= "ANCHOR_CURSOR" then return end
+
 	local x, y = GetCursorPosition();
 	local scale = frame:GetEffectiveScale();
 	local tipWidth = frame:GetWidth();
+
 	frame:ClearAllPoints();
-	frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", (x/scale + (E.db.tooltip.mouseOffsetX - tipWidth/2)), (y/scale + E.db.tooltip.mouseOffsetY));
+	--frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", (x/scale + (E.db.tooltip.mouseOffsetX - tipWidth/2)), (y/scale + E.db.tooltip.mouseOffsetY));
+	frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", (x/scale + (E.db.sle.tooltip.xOffset - tipWidth/2)), (y/scale + E.db.sle.tooltip.yOffset));
 end

-local function SetDefaultAnchor(self, tt, parent)
-	if E.private["tooltip"].enable ~= true then return end
-	if(tt:GetAnchorType() ~= "ANCHOR_CURSOR") then return end
+local function SetDefaultAnchor(self, tt, parent)
+	if (tt:GetAnchorType() ~= "ANCHOR_CURSOR") then
+		return
+	end
 	if InCombatLockdown() and self.db.visibility.combat then
 		tt:Hide()
 		return
 	end
-	if(parent) then
+	if (parent) then
 		if(self.db.cursorAnchor) then
 			AnchorFrameToMouse(tt);
 			return
@@ -34,19 +37,26 @@ local function SetDefaultAnchor(self, tt, parent)
 end

 local function OnTooltipSetUnit(self, tt)
-	if not E.db.sle.tooltipicon then return end
+	if not E.db.sle.tooltip.enable then return end
+	if not E.db.sle.tooltip.showFaction then return end
+
 	local unit = select(2, tt:GetUnit())
-	if(UnitIsPlayer(unit)) then
+	if (UnitIsPlayer(unit)) then
 		local text = GameTooltipTextLeft1:GetText()
 		local faction = UnitFactionGroup(unit)
+
 		if not faction then faction = "Neutral" end
+
 		GameTooltipTextLeft1:SetText("|T"..iconPath..faction..".blp:15:15:0:0:64:64:2:56:2:56|t "..text)
 	end
 end

 local function Init()
-	hooksecurefunc(TT, "CheckBackdropColor", AnchorFrameToMouse)
+	if not E.private.tooltip.enable then return end
 	hooksecurefunc(TT, "GameTooltip_OnTooltipSetUnit", OnTooltipSetUnit)
+
+	--if not E.db.tooltip.cursorAnchor then return end
+	hooksecurefunc(TT, "CheckBackdropColor", AnchorFrameToMouse)
 	hooksecurefunc(TT, "GameTooltip_SetDefaultAnchor", SetDefaultAnchor)
 end
 hooksecurefunc(TT, "Initialize", Init)
\ No newline at end of file