Skip to content

Commit

Permalink
Fix EasyMenu for Retail
Browse files Browse the repository at this point in the history
  • Loading branch information
doadin committed Jul 27, 2024
1 parent 8b91a76 commit 01d3f16
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Baggins-Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3753,7 +3753,7 @@ function Baggins:DoBagMenu()
func = openBagCategoryConfig,
notCheckable = true,
})
EasyMenu(menu, bagDropdownMenuFrame, "cursor", 0, 0, "MENU")
Baggins:EasyMenu(menu, bagDropdownMenuFrame, "cursor", 0, 0, "MENU")
end
end

Expand Down
25 changes: 21 additions & 4 deletions Baggins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ local ldbdata = {
if message == "RightButton" then
tooltip:Hide()
updateMenu()
EasyMenu(ldbDropDownMenu, ldbDropDownFrame, "cursor", 0, 0, "MENU")
Baggins:EasyMenu(ldbDropDownMenu, ldbDropDownFrame, "cursor", 0, 0, "MENU")
-- Baggins:OpenConfig()
else
Baggins:OnClick()
Expand Down Expand Up @@ -2478,7 +2478,7 @@ do
return
end
makeMenu(bag, slot)
EasyMenu(menu, itemDropdownFrame, "cursor", 0, 0, "MENU")
Baggins:EasyMenu(menu, itemDropdownFrame, "cursor", 0, 0, "MENU")
-- make sure we restore the original scroll-wheel behavior for the DropdownList2-Frame
-- when the item-dropdown is closed
Baggins:SecureHookScript(DropDownList1, "OnHide", function()
Expand Down Expand Up @@ -2510,7 +2510,7 @@ do
return
end
makeMenu(bag, slot)
EasyMenu(menu, itemDropdownFrame, "cursor", 0, 0, "MENU")
Baggins:EasyMenu(menu, itemDropdownFrame, "cursor", 0, 0, "MENU")
-- make sure we restore the original scroll-wheel behavior for the DropdownList2-Frame
-- when the item-dropdown is closed
Baggins:SecureHookScript(DropDownList1, "OnHide", function()
Expand Down Expand Up @@ -3604,7 +3604,7 @@ function BagginsOnAddonCompartmentClick(_,button)
if button == "RightButton" then
--tooltip:Hide()
updateMenu()
EasyMenu(ldbDropDownMenu, ldbDropDownFrame, "cursor", 0, 0, "MENU")
Baggins:EasyMenu(ldbDropDownMenu, ldbDropDownFrame, "cursor", 0, 0, "MENU")
-- Baggins:OpenConfig()
else
Baggins:OnClick()
Expand Down Expand Up @@ -4331,3 +4331,20 @@ local function GetItemUpgradeLevel(itemLink)
end

end

local function EasyMenu_Initialize(frame, level, menuList)
for index = 1, #menuList do
local value = menuList[index]
if value.text then value.index = index; UIDropDownMenu_AddButton(value, level) end
end
end

function Baggins:EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay)
if Baggins:IsRetailWow() then
if displayMode=='MENU' then menuFrame.displayMode = displayMode end
UIDropDownMenu_Initialize(menuFrame, EasyMenu_Initialize, displayMode, nil, menuList)
ToggleDropDownMenu(1, nil, menuFrame, anchor, x, y, menuList, nil, autoHideDelay)
else
EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay)
end
end
3 changes: 1 addition & 2 deletions src/filters/PeriodicTable.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ local AddOn = _G[AddOnName]
local pairs, type, tonumber, wipe, ceil =
pairs, type, tonumber, wipe, ceil
local GetContainerItemLink = C_Container and C_Container.GetContainerItemLink or GetContainerItemLink
local EasyMenu = EasyMenu
local tinsert, tsort =
tinsert, table.sort

Expand Down Expand Up @@ -128,7 +127,7 @@ local function showPTDropdown(info)
local attr = info[#info] --luacheck: ignore 211
currentRule = info.arg --luacheck: ignore 111
local menu = buildMenu(ptsets)
EasyMenu(menu, ptdropdownFrame, "cursor", 0, 0, "MENU")
AddOn:EasyMenu(menu, ptdropdownFrame, "cursor", 0, 0, "MENU")
end

-- Test for match
Expand Down

0 comments on commit 01d3f16

Please sign in to comment.