From 09e87fa0db89b63cb06da44ebd1d9289aaa22436 Mon Sep 17 00:00:00 2001 From: Scott Sibley Date: Fri, 8 Jul 2011 01:27:51 +0000 Subject: [PATCH] Use UI clamping. --- Modules/Appearance/Appearance.lua | 1 + Modules/Position/Position.lua | 33 +-------------------------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/Modules/Appearance/Appearance.lua b/Modules/Appearance/Appearance.lua index 75ae5eb..5c47ad4 100644 --- a/Modules/Appearance/Appearance.lua +++ b/Modules/Appearance/Appearance.lua @@ -395,6 +395,7 @@ function mod:OnEnable() local ctop = self.db.profile.clampTop local cbottom = self.db.profile.clampBottom StarTip.tooltipMain:SetClampRectInsets(cleft, cright, ctop, cbottom) + StarTip.tooltipMain:SetClampedToScreen(true) end function mod:OnDisable() diff --git a/Modules/Position/Position.lua b/Modules/Position/Position.lua index ba45807..407b7bd 100644 --- a/Modules/Position/Position.lua +++ b/Modules/Position/Position.lua @@ -404,41 +404,10 @@ local positionMainTooltip = function() local currentAnchor = StarTip.opposites[StarTip.anchors[index]:sub(8)] local tooltip = StarTip.tooltipMain local effScale = tooltip:GetEffectiveScale() - local height = tooltip:GetHeight() or 0 - local width = tooltip:GetWidth() or 0 - local realHeight = GameTooltip:GetHeight() - local realWidth = GameTooltip:GetWidth() - local screenWidth = UIParent:GetWidth() * effScale - local screenHeight = UIParent:GetHeight() * effScale - local realHeight = GameTooltip:GetHeight() - local realWidth = GameTooltip:GetWidth() - local myOffsetX, myOffsetY = 0, 0 - local leftBottomOffset = 0 - if mod.db.profile.defaultUnitTooltipPos == 1 then -- left - leftBottomOffset = realWidth - elseif mod.db.profile.defaultUnitTooltipPos == 2 then -- right - screenWidth = screenWidth - realWidth - elseif mod.db.profile.defaultUnitTooltipPos == 3 then -- top - screenHeight = screenHeight - realHeight - elseif mod.db.profile.defaultUnitTooltipPos == 4 then -- bottom - leftBottomOffset = realHeight - end - if x + width / 2 + xoffset > screenWidth then - myOffsetX = (screenWidth - (x + width / 2 + xoffset)) * effScale - end - if y + height + yoffset > screenHeight then - myOffsetY = (screenHeight - (y + height + yoffset) + 1) * effScale - end - if x - width / 2 - leftBottomOffset < 0 then - myOffsetX = (x - width / 2 - leftBottomOffset + 2) * -1 * effScale - end - if y - height - leftBottomOffset < 0 then - myOffsetY = (y - height - leftBottomOffset + 2) * effScale - end tooltip:ClearAllPoints() tooltip:SetPoint(currentAnchor, UIParent, "BOTTOMLEFT", - (x + xoffset + myOffsetX) / effScale, (y + yoffset + myOffsetY) / effScale + 5) + x / effScale, y / effScale) end -- 1.7.9.5