From fe42991e4a527514c302e97c4720656d45fae9a4 Mon Sep 17 00:00:00 2001 From: Brad Morgan Date: Sat, 14 Sep 2024 14:00:12 -0600 Subject: [PATCH] More fixes for scrolling text --- UI/ShoppingList.lua | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/UI/ShoppingList.lua b/UI/ShoppingList.lua index cb0599a..7514e64 100644 --- a/UI/ShoppingList.lua +++ b/UI/ShoppingList.lua @@ -66,6 +66,7 @@ local guildbankOnce = true -- but only indexGuildBank once for each OPENED -- -- Creates and sets up the shopping list window -- +SKILLET_SHOPPING_LIST_HEIGHT = 16 local function createShoppingListFrame(self) local frame = SkilletShoppingList if not frame then @@ -170,6 +171,10 @@ local function createShoppingListFrame(self) -- so hitting [ESC] will close the window -- tinsert(UISpecialFrames, frame:GetName()) +-- +-- Adjust the button height +-- + SKILLET_SHOPPING_LIST_HEIGHT = math.max(SkilletShoppingListButton1:GetHeight(), SKILLET_SHOPPING_LIST_HEIGHT) return frame end @@ -1236,20 +1241,19 @@ function Skillet:UpdateShoppingListWindow(use_cached_recipes) end) end local height = SkilletShoppingListParent:GetHeight() - local buttonH = SkilletShoppingListButton1:GetHeight() local width = SkilletShoppingListParent:GetWidth() - 30 -- Allow for scrollbars - --DA.DEBUG(1,"UpdateShoppingListWindow: height= "..tostring(height)..", buttonH= "..tostring(buttonH)) - --DA.DEBUG(1,"UpdateShoppingListWindow: SkilletShoppingListParent width= "..tostring(width)) - local button_count = height / buttonH + DA.DEBUG(1,"UpdateShoppingListWindow: height= "..tostring(height)..", SKILLET_SHOPPING_LIST_HEIGHT= "..tostring(SKILLET_SHOPPING_LIST_HEIGHT)) + DA.DEBUG(1,"UpdateShoppingListWindow: SkilletShoppingListParent width= "..tostring(width)) + local button_count = height / SKILLET_SHOPPING_LIST_HEIGHT button_count = math.floor(button_count) - 1 - --DA.DEBUG(1,"UpdateShoppingListWindow: numItems= "..tostring(numItems)..", button_count= "..tostring(button_count)..", num_buttons= "..tostring(num_buttons)) + DA.DEBUG(1,"UpdateShoppingListWindow: numItems= "..tostring(numItems)..", button_count= "..tostring(button_count)..", num_buttons= "..tostring(num_buttons)) -- -- Update the scroll frame -- - FauxScrollFrame_Update(SkilletShoppingListList, -- frame - numItems, -- num items - button_count, -- num to display - buttonH) -- value step (item height) + FauxScrollFrame_Update(SkilletShoppingListList, -- frame + numItems, -- num items + button_count, -- num to display + SKILLET_SHOPPING_LIST_HEIGHT) -- value step (item height) -- -- Where in the list of items to start counting. -- @@ -1269,6 +1273,7 @@ function Skillet:UpdateShoppingListWindow(use_cached_recipes) local player_width = math.max(button_width * 0.3, 100) local name_width = math.max(button_width - count_width - player_width, 125) count:SetWidth(count_width) + name:SetWordWrap(false) name:SetWidth(name_width) name:SetPoint("LEFT", count:GetName(), "RIGHT", 4) player:SetWidth(player_width)