mirror of
https://github.com/airstruck/luigi.git
synced 2026-01-10 16:28:23 +00:00
move reflow to widgets
This commit is contained in:
@@ -144,10 +144,7 @@ end
|
|||||||
function Input:handleReshape (width, height)
|
function Input:handleReshape (width, height)
|
||||||
local layout = self.layout
|
local layout = self.layout
|
||||||
local root = layout.root
|
local root = layout.root
|
||||||
for i, widget in ipairs(layout.widgets) do
|
layout.root:reflow()
|
||||||
widget.position = {}
|
|
||||||
widget.dimensions = {}
|
|
||||||
end
|
|
||||||
root.width = width
|
root.width = width
|
||||||
root.height = height
|
root.height = height
|
||||||
Event.Reshape:emit(root, {
|
Event.Reshape:emit(root, {
|
||||||
|
|||||||
@@ -61,14 +61,6 @@ function Layout:hide ()
|
|||||||
self:unhook()
|
self:unhook()
|
||||||
end
|
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.
|
-- Get the innermost widget at a position, within a root widget.
|
||||||
-- Should always return a widget since all positions are within
|
-- Should always return a widget since all positions are within
|
||||||
-- the layout's root widget.
|
-- the layout's root widget.
|
||||||
|
|||||||
@@ -232,12 +232,12 @@ function Widget:getAncestors (includeSelf)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Reflow the widget. Call this after changing position/dimensions.
|
||||||
function Widget:reflow ()
|
function Widget:reflow ()
|
||||||
self.position = {}
|
self.position = {}
|
||||||
self.dimensions = {}
|
self.dimensions = {}
|
||||||
for i, widget in ipairs(self.children) do
|
for i, widget in ipairs(self.children) do
|
||||||
widget.position = {}
|
widget:reflow()
|
||||||
widget.dimensions = {}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user