Skip to content

Commit 0979358

Browse files
TimMenu/Layout/Sector: fixes to menu sectors
1 parent a02ed39 commit 0979358

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

TimMenu/Layout/Sector.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,16 @@ end
9090

9191
local function _finalizeCursorAndLayout(win, sector_data, width, height, pad)
9292
win.cursorX = sector_data.startX + width + pad
93+
-- Keep cursorY at the top of this sector for side-by-side placement
94+
-- The window's own lineHeight tracking will handle vertical wrapping
9395
win.cursorY = sector_data.startY
9496
win.lineHeight = math.max(win.lineHeight or 0, height)
9597

9698
if #win._sectorStack > 0 then
9799
local parentSector = win._sectorStack[#win._sectorStack]
98100
parentSector.maxX = math.max(parentSector.maxX, sector_data.startX + width)
99-
parentSector.maxY = math.max(parentSector.maxY, win.cursorY + win.lineHeight)
101+
-- Use actual bottom of child sector, not reset cursor position
102+
parentSector.maxY = math.max(parentSector.maxY, sector_data.startY + height)
100103
end
101104
end
102105

@@ -145,8 +148,10 @@ function Sector.Begin(win, label)
145148
self.cursorY = self.cursorY + self.lineHeight + baseSpacing + extra
146149
-- Keep cursorX constrained to sector's indented start position
147150
self.cursorX = sector_data.startX + sector_data.padding
148-
-- track y position after line break relative to window origin
149-
sector_data.maxY = math.max(sector_data.maxY, self.cursorY + self.lineHeight)
151+
-- Don't update maxY here - let AddWidget expand bounds only when widgets are actually added
152+
-- This prevents empty space when conditionals hide content after NextLine
153+
-- Reset lineHeight for the new line (matches Window:NextLine behavior)
154+
self.lineHeight = 0
150155
end
151156

152157
-- indent cursor for sector padding

0 commit comments

Comments
 (0)