fix: resize pages after re-parenting to monitor device
Page:postInit defaults parent to UI.term (small computer terminal). Window:postInit then calls setParent() which computes all child dimensions from that small terminal. When we later re-parent to the monitor device, the children retain their small dimensions. Adding resize() before setParent() forces all children to recompute dimensions from the correct monitor size.
This commit is contained in:
@@ -446,9 +446,11 @@ local function buildMainPage()
|
||||
btnX = btnX + #tostring(amt) + 4
|
||||
end
|
||||
|
||||
-- Attach to device
|
||||
-- Attach to device (must resize to recompute all child dimensions
|
||||
-- from the monitor device, since Page:postInit defaulted to UI.term)
|
||||
mainDevice.currentPage = mainPage
|
||||
mainPage.parent = mainDevice
|
||||
mainPage:resize()
|
||||
mainPage:setParent()
|
||||
mainPage:enable()
|
||||
end
|
||||
@@ -886,6 +888,7 @@ local function buildSmelterPage()
|
||||
-- Attach to device
|
||||
smelterDevice.currentPage = smelterPage
|
||||
smelterPage.parent = smelterDevice
|
||||
smelterPage:resize()
|
||||
smelterPage:setParent()
|
||||
smelterPage:enable()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user