Quantcast

Provide an intersect-rate option.

Scott Sibley [09-18-10 - 06:58]
Provide an intersect-rate option.
Bug fix
Filename
Modules/Histograms.lua
StarTip.lua
diff --git a/Modules/Histograms.lua b/Modules/Histograms.lua
index aec660a..6b94f96 100644
--- a/Modules/Histograms.lua
+++ b/Modules/Histograms.lua
@@ -116,7 +116,7 @@ end
 		update = 1000,
 		persistent = true,
 		intersect = true,
-		intersecPad = 100
+		intersecPad = 200,
 		--[[intersectxPad1 = -100,
 		intersectyPad1 = -100,
 		intersectxPad2 = -100,
@@ -153,7 +153,7 @@ end
 		update = 1000,
 		persistent = true,
 		intersect = true,
-		intersectPad = 100
+		intersectPad = 200
 	},

 }
@@ -161,7 +161,8 @@ end
 local defaults = {
 	profile = {
 		classColors = true,
-		histograms = {}
+		histograms = {},
+		intersect = true
 	}
 }

@@ -390,7 +391,10 @@ function mod:OnEnable()
 	self:ClearHistograms()
 	createHistograms()
 	StarTip:SetOptionsDisabled(options, false)
-	self.intersectTimer = self.intersectTimer or LibTimer:New("Texts.intersectTimer", 100, true, intersectUpdate)
+	StarTip:Print(StarTip.db.profile.intersectRate)
+	if StarTip.db.profile.intersectRate > 0 then
+		self.intersectTimer = self.intersectTimer or LibTimer:New("Texts.intersectTimer", self.db.profile.intersectRate or 200, true, intersectUpdate)
+	end
 end

 function mod:OnDisable()
@@ -414,7 +418,9 @@ function mod:SetUnit()
 		end
 		widget:Start()
 	end
-	self.intersectTimer:Start()
+	if self.intersectTimer then
+		self.intersectTimer:Start()
+	end
 end

 function mod:SetItem()
@@ -426,7 +432,9 @@ function mod:SetItem()
 			widget:Stop()
 		end
 	end
-	self.intersectTimer:Start()
+	if self.intersectTimer then
+		self.intersectTimer:Start()
+	end
 end

 function mod:SetSpell()
@@ -438,7 +446,9 @@ function mod:SetSpell()
 			widget:Stop()
 		end
 	end
-	self.intersectTimer:Start()
+	if self.intersectTimer then
+		self.intersectTimer:Start()
+	end
 end

 function mod:OnHide()
@@ -454,7 +464,9 @@ function mod:OnHide()
 			widget:Stop()
 		end
 	end
-	self.intersectTimer:Stop()
+	if self.intersectTimer then
+		self.intersectTimer:Stop()
+	end
 end

 local function colorGradient(perc)
diff --git a/StarTip.lua b/StarTip.lua
index 3af02f8..2fc50ea 100644
--- a/StarTip.lua
+++ b/StarTip.lua
@@ -173,7 +173,8 @@ local defaults = {
 		unitFrameShow = 1,
 		otherFrameShow = 1,
 		errorLevel = 1,
-		throttleVal = 0
+		throttleVal = 0,
+		intersectRate = 200
 	}
 }

@@ -306,7 +307,17 @@ local options = {
 					type = "input",
 					pattern = "%d",
 					get = function() return tostring(StarTip.db.profile.throttleVal) end,
-					set = function(info, v) StarTip.db.profile.throttleVal = tonumber(v) end
+					set = function(info, v) StarTip.db.profile.throttleVal = tonumber(v) end,
+					order = 12
+				},
+				intersectRate = {
+					name = "Intersect Checks Rate",
+					desc = "The rate at which intersecting frames will be checked",
+					type = "input",
+					pattern = "%d",
+					get = function() return tostring(StarTip.db.profile.intersectRate) end,
+					set = function(info, v) StarTip.db.profile.intersectRate = tonumber(v) end,
+					order = 13
 				}
 			}
 		}