Quantcast

Bug fix. Regions with paddings work now.

Scott Sibley [09-17-10 - 21:54]
Bug fix. Regions with paddings work now.
Filename
Modules/Bars.lua
Modules/Histograms.lua
Modules/Text.lua
diff --git a/Modules/Bars.lua b/Modules/Bars.lua
index 0e3dd44..a71c6dd 100644
--- a/Modules/Bars.lua
+++ b/Modules/Bars.lua
@@ -153,9 +153,11 @@ local intersectUpdate = function()
 				if environment.Intersect(frame, widget.bar, widget.config.intersectxPad1 or widget.config.intersectPad or 0, widget.config.intersectyPad1 or widget.config.intersectPad or 0, widget.config.intersectxPad2 or widget.config.intersectPad or 0, widget.config.intersectyPad2 or widget.config.intersectPad or 0) then
 					widget.hidden = true
 					bar:Hide()
-				elseif environment.Intersect(frame, widget.bar, widget.config.intersectxPad1 or widget.config.intersectPad or 0, widget.config.intersectyPad1 or widget.config.intersectPad or 0, widget.config.intersectxPad2 or widget.config.intersectPad or 0, widget.config.intersectyPad2 or widget.config.intersectPad or 0) then
+					widget:Stop()
+				elseif not environment.Intersect(frame, widget.bar, widget.config.intersectxPad1 or widget.config.intersectPad or 0, widget.config.intersectyPad1 or widget.config.intersectPad or 0, widget.config.intersectxPad2 or widget.config.intersectPad or 0, widget.config.intersectyPad2 or widget.config.intersectPad or 0) and widget.hidden then
 					widget.hidden = false
 					bar:Show()
+					widget:Start()
 				end
 			end
 		end
diff --git a/Modules/Histograms.lua b/Modules/Histograms.lua
index e9a3cba..8c08a87 100644
--- a/Modules/Histograms.lua
+++ b/Modules/Histograms.lua
@@ -117,7 +117,7 @@ end
 		update = 1000,
 		persistent = true,
 		intersect = true,
-		intersectPad = 100
+		intersectPad = 1000
 	},
 	[4] = {
 		name = "CPU",
@@ -204,13 +204,16 @@ local insersectTimer
 local intersectUpdate = function()
 	local frame = GetMouseFocus()
 	if frame and frame ~= UIParent and frame ~= WorldFrame  then
-		for k, widget in pairs(mod.histograms or {}) do
+		for k, widget in pairs(mod.histograms) do
 			for i, bar in ipairs(widget.bars or {}) do
 				if widget.config.intersect then
-					if environment.Intersect(frame, bar, widget.config.intersectxPad1 or widget.config.intersectPad or 0, widget.config.intersectyPad1 or widget.config.intersectPad or 0, widget.config.intersectxPad2 or widget.config.intersectPad or 0, widget.config.intersectyPad2 or widget.config.intersectPad or 0) then
+					--if environment.Intersect(bar, frame, widget.config.intersectxPad1 or widget.config.intersectPad or 0, widget.config.intersectyPad1 or widget.config.intersectPad or 0, widget.config.intersectxPad2 or widget.config.intersectPad or 0, widget.config.intersectyPad2 or widget.config.intersectPad or 0) then
+					if environment.Intersect(frame, bar, widget.config.intersectxPad1 or widget.config.itnersectPad or 0, widget.config.intersectyPad1 or widget.config.intersectPad or 0, widget.config.intersectxPad2 or widget.config.intersectPad or 0, widget.config.intersectyPad2 or widget.config.intersectPad or 0) then
 						widget.hidden = true
 						bar:Hide()
-					elseif environment.Intersect(frame, bar, widget.config.intersectxPad1 or widget.config.intersectPad or 0, widget.config.intersectyPad1 or widget.config.intersectPad or 0, widget.config.intersectxPad2 or widget.config.intersectPad or 0, widget.config.intersectyPad2 or widget.config.intersectPad or 0) then
+						widget.frame:Hide()
+						StarTip:Print("intersect", widget.name)
+					elseif not environment.Intersect(bar, frame) and widget.hidden then
 						widget.hidden = false
 						bar:Show()
 					end
@@ -334,7 +337,8 @@ local function createHistograms()
 					bar:SetMinMaxValues(0, 100)
 					bar:SetOrientation("VERTICAL")
 					bar:SetValue(0)
-					bar:Show()
+					widget.frame = bar
+					bar.widget = widget
 					if not widget.bars then widget.bars = {} end
 					tinsert(widget.bars, bar)
 				end
diff --git a/Modules/Text.lua b/Modules/Text.lua
index d1384c9..2f885ff 100644
--- a/Modules/Text.lua
+++ b/Modules/Text.lua
@@ -152,7 +152,8 @@ end
 		parent = "GameTooltip",
 		strata = 1,
 		level = 1,
-		intersect = true
+		intersect = true,
+		intersectPad = 100
 	},
 	[5] = {
 		name = "Memory Total",
@@ -172,7 +173,8 @@ end
 		parent = "GameTooltip",
 		strata = 1,
 		level = 1,
-		intersect = true
+		intersect = true,
+		intersectPad = 100
 	},
 	[6] = {
 		name = "CPU Percent",
@@ -201,7 +203,8 @@ end
 		parent = "GameTooltip",
 		strata = 1,
 		level = 1,
-		intersect = true
+		intersect = true,
+		intersectPad = 100
 	},
 	[7] = {
 		name = "CPU Total",
@@ -222,7 +225,8 @@ end
 		parent = "GameTooltip",
 		strata = 1,
 		level = 1,
-		intersect = true
+		intersect = true,
+		intersectPad = 100
 	},
 }

@@ -277,12 +281,14 @@ local intersectUpdate = function()
 	if frame and frame ~= UIParent and frame ~= WorldFrame then
 		for k, widget in pairs(mod.texts) do
 			if widget.config.intersect then
-				if environment.Intersect(frame, widget.frame, widget.config.intersectxPad1 or widget.config.intersectPad or 0, widget.config.intersectyPad1 or widget.config.intersectPad or 0, widget.config.intersectxPad2 or widget.config.intersectPad or 0, widget.config.intersectyPad2 or widget.config.intersectPad or 0) then
+				if environment.Intersect(widget.frame, frame, widget.config.intersectxPad1 or widget.config.intersectPad or 0, widget.config.intersectyPad1 or widget.config.intersectPad or 0, widget.config.intersectxPad2 or widget.config.intersectPad or 0, widget.config.intersectyPad2 or widget.config.intersectPad or 0) then
 					widget.hidden = true
-					widget.frame:Hide()
-				elseif environment.Intersect(frame, widget.frame, widget.config.intersectxPad1 or widget.config.intersectPad or 0, widget.config.intersectyPad1 or widget.config.intersectPad or 0, widget.config.intersectxPad2 or widget.config.intersectPad or 0, widget.config.intersectyPad2 or widget.config.intersectPad or 0) then
+					widget.frame.fontstring:Hide()
+					widget:Stop()
+				elseif not environment.Intersect(widget.frame, frame, widget.config.intersectxPad1 or widget.config.intersectPad or 0, widget.config.intersectyPad1 or widget.config.intersectPad or 0, widget.config.intersectxPad2 or widget.config.intersectPad or 0, widget.config.intersectyPad2 or widget.config.intersectPad or 0) and widget.hidden then
 					widget.hidden = false
 					widget.frame:Show()
+					widget:Start()
 				end
 			end
 		end