move reflow to widgets

This commit is contained in:
airstruck
2015-10-24 15:32:48 -04:00
parent cc0ca8387b
commit 93f0108242
3 changed files with 3 additions and 14 deletions

View File

@@ -144,10 +144,7 @@ end
function Input:handleReshape (width, height)
local layout = self.layout
local root = layout.root
for i, widget in ipairs(layout.widgets) do
widget.position = {}
widget.dimensions = {}
end
layout.root:reflow()
root.width = width
root.height = height
Event.Reshape:emit(root, {

View File

@@ -61,14 +61,6 @@ function Layout:hide ()
self:unhook()
end
-- Reflow the layout. Call this after you change widget positions/dimensions.
function Layout:reflow (reshape)
for i, widget in ipairs(self.widgets) do
widget.position = {}
widget.dimensions = {}
end
end
-- Get the innermost widget at a position, within a root widget.
-- Should always return a widget since all positions are within
-- the layout's root widget.

View File

@@ -232,12 +232,12 @@ function Widget:getAncestors (includeSelf)
end
end
-- Reflow the widget. Call this after changing position/dimensions.
function Widget:reflow ()
self.position = {}
self.dimensions = {}
for i, widget in ipairs(self.children) do
widget.position = {}
widget.dimensions = {}
widget:reflow()
end
end