Quantcast

Checking for intersecting frames should work now.

Scott Sibley [09-23-10 - 09:36]
Checking for intersecting frames should work now.
Hide the tooltip after mousing over unit frames.
Filename
Modules/Debug.lua
StarTip.lua
modules.xml
diff --git a/Modules/Debug.lua b/Modules/Debug.lua
index 224f5ff..3d9de6e 100644
--- a/Modules/Debug.lua
+++ b/Modules/Debug.lua
@@ -56,22 +56,18 @@ local function new3()
 end

 local plugin = {}
-LibStub("StarLibPluginString-1.0"):New(plugin)
+LibStub("StarLibPluginUtils-1.0"):New(plugin)

 local function update()
-	for i, v in ipairs(objects) do
-		v:Del()
+	mod.frame1:ClearAllPoints()
+	mod.frame2:ClearAllPoints()
+	local width = UIParent:GetWidth()
+	local height = UIParent:GetHeight()
+	mod.frame2:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 550 / 0.5 / 0.2, 550 / 0.5 / 0.2)
+	mod.frame3:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 550, 550)
+	if plugin.Intersect(mod.frame2, mod.frame3) then
+		StarTip:Print("---------------intersection-----------------")
 	end
-	wipe(objects)
-	ResourceServer.Update()
-	local mem1, percent1, memdiff1, totalMem1, totaldiff1 = ResourceServer.GetMemUsage("StarTip")
-	for j = 1, 5 do
-		local object = new1()
-		tinsert(objects, object)
-	end
-	ResourceServer.Update()
-	local mem2, percent2, memdiff2, totalMem2, totaldiff2 = ResourceServer.GetMemUsage("StarTip")
-	StarTip:Print("Memory", plugin.memshort(mem2), plugin.memshort(mem2 - mem1), plugin.memshort(memdiff2))
 end

 function mod:OnEnable()
@@ -79,6 +75,69 @@ function mod:OnEnable()
 	if false then
 		timer:Start()
 	end
+	do return end
+			local frame = CreateFrame("Frame")
+			frame:SetParent(UIParent)
+			frame:SetParent(UIParent)
+				frame:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
+					tile = true,
+					tileSize = 4,
+					edgeSize=4,
+					insets = { left = 0, right = 0, top = 0, bottom = 0}})
+			frame:ClearAllPoints()
+			frame:SetAlpha(1)
+			frame:SetBackdropColor(1, 1, 0)
+			frame:SetHeight(250)
+			frame:SetWidth(250)
+			frame:Show()
+			frame:SetScale(0.2)
+			self.frame0 = frame
+
+			local frame = CreateFrame("Frame")
+			frame:SetParent(self.frame0)
+				frame:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
+					tile = true,
+					tileSize = 4,
+					edgeSize=4,
+					insets = { left = 0, right = 0, top = 0, bottom = 0}})
+			frame:ClearAllPoints()
+			frame:SetAlpha(1)
+			frame:SetBackdropColor(1, 1, 0)
+			frame:SetHeight(250)
+			frame:SetWidth(250)
+			frame:Show()
+			frame:SetScale(0.5)
+			self.frame1 = frame
+
+			local frame = CreateFrame("Frame")
+			frame:SetParent(self.frame1)
+				frame:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
+					tile = true,
+					tileSize = 4,
+					edgeSize=4,
+					insets = { left = 0, right = 0, top = 0, bottom = 0}})
+			frame:ClearAllPoints()
+			frame:SetAlpha(1)
+			frame:SetBackdropColor(1, 1, 0)
+			frame:SetHeight(250)
+			frame:SetWidth(250)
+			frame:Show()
+			self.frame2 = frame
+
+			local frame = CreateFrame("Frame")
+			frame:SetParent(UIParent)
+				frame:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
+					tile = true,
+					tileSize = 4,
+					edgeSize=4,
+					insets = { left = 0, right = 0, top = 0, bottom = 0}})
+			frame:ClearAllPoints()
+			frame:SetAlpha(1)
+			frame:SetBackdropColor(1, 1, 0)
+			frame:SetHeight(250)
+			frame:SetWidth(250)
+			frame:Show()
+			self.frame3 = frame
 end

 function mod:OnDisable()
diff --git a/StarTip.lua b/StarTip.lua
index e1a6920..37ee56a 100644
--- a/StarTip.lua
+++ b/StarTip.lua
@@ -636,19 +636,10 @@ end

 local hideTimer
 local function hideTooltip()
-	local mod = StarTip:GetModule("UnitTooltip")
-	if GameTooltip:GetAlpha() < 1 then GameTooltip:Hide(); StarTip.unit = false; return end
-	if GameTooltip:NumLines() > mod.NUM_LINES then GameTooltip:Hide(); StarTip.unit = false; return end
-	if UnitGUID(StarTip.unit or "mouseover") == UnitGUID("player") and StarTip.unit ~= "player" then GameTooltip:Hide(); StarTip.unit = false; return end
-	if not StarTip.unit then GameTooltip:Hide() return end
+	if StarTip.unit ~= "mouseover" and (GetMouseFocus() == UIParent or GetMouseFocus() == WorldFrame) then GameTooltip:Hide(); StarTip.unit = nil; return end
 	hideTimer:Start()
 end

-local playerUnitTimer
-local function playerUnitHide()
-	GameTooltip:Hide()
-end
-
 local throttleTimer
 local lastTime = GetTime()
 local function endThrottle()
@@ -659,9 +650,10 @@ end

 function StarTip.OnTooltipSetUnit(...)

+	local unit = GameTooltip:GetUnit()

 	hideTimer = hideTimer or LibTimer:New("StarTip.Hide", 100, false, hideTooltip, nil, StarTip.db.profile.errorLevel)
-	hideTimer:Stop()
+	hideTimer:Start()
 	throttleTimer = throttleTimer or LibTimer:New("StarTip.Throttle", StarTip.db.profile.throttleVal, false, endThrottle, nil, StarTip.db.profile.errorLevel)
 	if GetTime() < lastTime + StarTip.db.profile.throttleVal and UnitIsPlayer("mouseover") and StarTip.db.profile.throttleVal > 0 then
 		hideTimer:Start()
@@ -672,7 +664,6 @@ function StarTip.OnTooltipSetUnit(...)
 	lastTime = GetTime()

 	StarTip.fading = false
-	local unit = GameTooltip:GetUnit()
 	StarTip.unit = "mouseover"
 	if not UnitExists("mouseover") then
 		if UnitInRaid("player") then
@@ -705,10 +696,11 @@ function StarTip.OnTooltipSetUnit(...)

 	if not UnitExists(StarTip.unit) then GameTooltip:Hide(); return end

-	if StarTip.unit == "player" then
-		playerUnitTimer = playerUnitTimer or LibTimer:New("StarTip.Throttle", 2, false, playerUnitHide, nil, StarTip.db.profile.errorLevel)
-		playerUnitTimer:Start()
-	end
+	--[[if StarTip.unit ~= "mouseover" then
+		unitFrameTimer = unitFrameTimer or LibTimer:New("StarTip.Throttle", 2, false, unitFrameHide, nil, StarTip.db.profile.errorLevel)
+		unitFrameTimer:Start()
+	end]]
+
 	if not StarTip.justSetUnit then
 		for k, v in StarTip:IterateModules() do
 			if v.SetUnit and v:IsEnabled() then v:SetUnit() end
diff --git a/modules.xml b/modules.xml
index dd0ccb0..5592ac8 100644
--- a/modules.xml
+++ b/modules.xml
@@ -13,8 +13,6 @@
 <Script file = "Modules\Histograms.lua"/>
 <Script file = "Modules\UnitTooltip.lua"/>

-<!--
 <Script file = "Modules\Debug.lua"/>
--->

 </Ui>