From 3e24fe6920cf2990ebbf4e9fde3811a9d650b398 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Mon, 15 Sep 2014 03:27:05 +0200 Subject: [PATCH] Make sure the dropdown stays on the screen --- Broker_Equipment.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Broker_Equipment.lua b/Broker_Equipment.lua index 987d322..12e5803 100644 --- a/Broker_Equipment.lua +++ b/Broker_Equipment.lua @@ -174,7 +174,22 @@ function LDB:OnClick(button) else UpdateMenu(self) Menu:ClearAllPoints() - Menu:SetPoint('TOP', self, 'BOTTOM') + Menu:SetPoint('TOP', self, 'BOTTOM') -- temporary anchor + + local sideAnchor = '' + if(Menu:GetRight() > GetScreenWidth()) then + sideAnchor = 'RIGHT' + elseif(Menu:GetLeft() <= 0) then + sideAnchor = 'LEFT' + end + + Menu:ClearAllPoints() + if(Menu:GetBottom() <= 0) then + Menu:SetPoint('BOTTOM' .. sideAnchor, self, 'TOP' .. sideAnchor) + else + Menu:SetPoint('TOP' .. sideAnchor, self, 'BOTTOM' .. sideAnchor) + end + Menu:Show() end -- 1.7.9.5