Skip to content

Commit

Permalink
More fixes for scrolling text
Browse files Browse the repository at this point in the history
  • Loading branch information
b-morgan committed Sep 14, 2024
1 parent 0a32c1f commit fe42991
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions UI/ShoppingList.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.
--
Expand All @@ -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)
Expand Down

0 comments on commit fe42991

Please sign in to comment.