From e01e0486d89cf4b392323bbf5b02919c0c399238 Mon Sep 17 00:00:00 2001 From: Artur Morozov Date: Mon, 4 Mar 2019 17:12:41 +0300 Subject: [PATCH] api: update SkinDropDown fix dynamic dropdown menus --- api/ui-widgets.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/api/ui-widgets.lua b/api/ui-widgets.lua index 4eb35515..00ad90d1 100644 --- a/api/ui-widgets.lua +++ b/api/ui-widgets.lua @@ -519,13 +519,12 @@ function pfUI.api.SkinDropDown(frame, cr, cg, cb) button:SetHighlightTexture(nil) button:SetDisabledTexture(nil) - StripTextures(button) CreateBackdrop(button) button.backdrop:ClearAllPoints() button.backdrop:SetWidth(18) button.backdrop:SetHeight(18) - button.backdrop:SetPoint("RIGHT", button, "RIGHT", -2, 0) + button.backdrop:SetPoint("RIGHT", frame.backdrop, "RIGHT", -2, 0) if not button.icon then button.icon = button:CreateTexture(nil, "OVERLAY") @@ -548,13 +547,17 @@ function pfUI.api.SkinDropDown(frame, cr, cg, cb) if funcc then funcc() end UIDropDownMenu_JustifyText("RIGHT", this:GetParent()) DropDownList1:SetPoint("TOPLEFT", this:GetParent().backdrop, "BOTTOMLEFT", 0, -4) - DropDownList1:SetPoint("TOPRIGHT", this:GetParent().backdrop, "BOTTOMRIGHT", 0, -4) - CreateBackdrop(DropDownList1Backdrop, nil, true, .8) - DropDownList1.maxWidth = this:GetWidth() > 80 and this:GetWidth() or 80 - for i=1, UIDROPDOWNMENU_MAXBUTTONS do - _G["DropDownList1Button" .. i]:SetWidth(DropDownList1.maxWidth) + local DropDownListWidth = DropDownList1:GetWidth() + local DropDownFrameWidth = this:GetParent().backdrop:GetWidth() + if DropDownListWidth < DropDownFrameWidth then + local diff = DropDownFrameWidth - DropDownListWidth + DropDownList1:SetWidth(DropDownList1:GetWidth() + diff) + for i=1, UIDROPDOWNMENU_MAXBUTTONS do + _G["DropDownList1Button" .. i]:SetWidth(_G["DropDownList1Button" .. i]:GetWidth() + diff) + end end + CreateBackdrop(DropDownList1Backdrop, nil, true, .8) end) frame.button = button