From 47f8ec1d3a4e642835ce2b9b54682534af84fb03 Mon Sep 17 00:00:00 2001 From: Scott Sibley Date: Mon, 14 Mar 2011 06:12:55 +0000 Subject: [PATCH] Allow users to configure GameTooltip frame clamping. --- Modules/Appearance/Appearance.lua | 54 +++++++++++++++++++++++++++++++++++-- Modules/Bars/Bars.lua | 2 -- Modules/Histograms/Histograms.lua | 1 - Modules/Texts/Texts.lua | 2 -- 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/Modules/Appearance/Appearance.lua b/Modules/Appearance/Appearance.lua index beba040..faab481 100644 --- a/Modules/Appearance/Appearance.lua +++ b/Modules/Appearance/Appearance.lua @@ -33,7 +33,11 @@ local defaults = { paddingBottom = 4, paddingLeft = 4, paddinRight = 4, - edgeSize = 16 + edgeSize = 16, + clampLeft = 0, + clampRight = 10, + clampTop = 10, + clampBottom = 10 } } @@ -200,11 +204,51 @@ local options = { set = set, order = 15 }, + clampLeft = { + name = "Clamp Left", + type = "range", + min = -200, + max = 200, + step = 5, + get = get, + set = set, + order = 16 + }, + clampRight = { + name = "Clamp Right", + type = "range", + min = -200, + max = 200, + step = 5, + get = get, + set = set, + order = 17 + }, + clampTop = { + name = "Clamp Top", + type = "range", + min = -200, + max = 200, + step = 5, + get = get, + set = set, + order = 18 + }, + clampBottom = { + name = "Clamp Bottom", + type = "range", + min = -200, + max = 200, + step = 5, + get = get, + set = set, + order = 19 + }, bgColor = { name = "Background Color", desc = "Set options for background color", type = "group", - order = 16, + order = 100, get = function(info) return unpack(self.db.profile.bgColor[info[#info]]) end, @@ -350,6 +394,11 @@ function mod:OnEnable() self:SetBorderColor() self:SetBackdropColor(true) StarTip:SetOptionsDisabled(options, false) + local cleft = self.db.profile.clampLeft + local cright = self.db.profile.clampRight + local ctop = self.db.profile.clampTop + local cbottom = self.db.profile.clampBottom + GameTooltip:SetClampRectInsets(cleft, cright, ctop, cbottom) end function mod:OnDisable() @@ -359,6 +408,7 @@ function mod:OnDisable() self:SetBackdrop(true) self:SetBackdropColor(true) StarTip:SetOptionsDisabled(options, true) + GameTooltip:SetClampRectInsets(0, 0, 0, 0) end function mod:GetOptions() diff --git a/Modules/Bars/Bars.lua b/Modules/Bars/Bars.lua index 7436a07..9ab8ac0 100644 --- a/Modules/Bars/Bars.lua +++ b/Modules/Bars/Bars.lua @@ -385,7 +385,6 @@ function mod:OnInitialize() end function mod:OnEnable() - GameTooltip:SetClampRectInsets(0, 0, 10, 10) StarTip:SetOptionsDisabled(options, false) intersectTimer = intersectTimer or LibTimer:New("Texts.intersectTimer", 100, true, intersectUpdate) self:ClearBars() @@ -403,7 +402,6 @@ end function mod:OnDisable() self:ClearBars() - GameTooltip:SetClampRectInsets(0, 0, 0, 0) StarTip:SetOptionsDisabled(options, true) if type(intersectTimer) == "table" then intersectTimer:Stop() end end diff --git a/Modules/Histograms/Histograms.lua b/Modules/Histograms/Histograms.lua index cb1f2d9..199af11 100644 --- a/Modules/Histograms/Histograms.lua +++ b/Modules/Histograms/Histograms.lua @@ -396,7 +396,6 @@ end function mod:OnDisable() self.core:Del() self:ClearHistograms() - GameTooltip:SetClampRectInsets(0, 0, 0, 0) StarTip:SetOptionsDisabled(options, true) if self.intersectTimer then self.intersectTimer:Stop() end end diff --git a/Modules/Texts/Texts.lua b/Modules/Texts/Texts.lua index 1dc6c71..fcb0539 100644 --- a/Modules/Texts/Texts.lua +++ b/Modules/Texts/Texts.lua @@ -467,7 +467,6 @@ end function mod:OnEnable() self:ClearTexts() intersectTimer = intersectTimer or LibTimer:New("Texts.intersectTimer", 100, true, intersectUpdate) - GameTooltip:SetClampRectInsets(0, 0, 10, 10) StarTip:SetOptionsDisabled(options, false) createTexts() for k, text in pairs(self.texts) do @@ -484,7 +483,6 @@ function mod:OnDisable() if type(intersectTimer) == "table" then intersectTimer:Stop() end - GameTooltip:SetClampRectInsets(0, 0, 0, 0) StarTip:SetOptionsDisabled(options, true) end -- 1.7.9.5