BFD:BFD[
4.2] → [
5.699:742]
BF:BFD[
5.742] → [
11.4307:4307]
BF:BFD[
4.2] → [
11.6990:7033]
BF:BFD[
11.7033] → [
11.4307:4307]
BF:BFD[
4.2] → [
11.6990:7033]
B:BD[
11.4307] → [
2.252:312]
B:BD[
11.5191] → [
2.313:346]
B:BD[
11.6029] → [
2.347:415]
B:BD[
11.6717] → [
2.416:484]
B:BD[
11.6986] → [
2.485:488]
∅:D[
2.484] → [
11.6779:6960]
∅:D[
2.415] → [
11.6091:6717]
∅:D[
2.346] → [
11.5254:5260]
∅:D[
2.312] → [
11.4398:4660]
compute_layout = function(node, x,y, nodes_to_render, font)
update_editor_box(node, font)
subx,suby = compute_layout(child, x,suby, nodes_to_render, font)
subx,suby = compute_layout(child, subx,y, nodes_to_render, font)
end
w = w + child.w
if h < child.h then
h = child.h
end
end
node.w = w
node.h = h
if node_to_render then
node_to_render.w = w
node_to_render.h = h
end
end
if w < child.w then
w = child.w
end
h = h+child.h
end
node.w = w
node.h = h
if node_to_render then
node_to_render.w = w
node_to_render.h = h
end
elseif node.type == 'cols' then
node.x = x
node.y = y
-- lay out children left to right
local node_to_render
if node.bg then
node_to_render = {type='rectangle', r=node.bg.r, g=node.bg.g, b=node.bg.b, x=node.x, y=node.y}
table.insert(nodes_to_render, node_to_render)
end
local subx,suby = x,y
local w,h = 0,0
for _,child in ipairs(node.data) do
if child.margin then
subx = subx+child.margin
w = w+child.margin
end
end
-- append to nodes_to_render flattened instructions to render a hierarchy of nodes
-- return x,y rendered until (surface coordinates)
if node.type == 'text' then
-- leaf node containing raw text
node.x = x
node.y = y
-- render background if necessary