17,273
edits
(yeah passing args around like that is a bad idea. (not gonna fix it rn tho)) |
(use Args.fromFrame) |
||
Line 182: | Line 182: | ||
function p.tabs( frame ) | function p.tabs( frame ) | ||
local args = Args. | local args = Args.fromFrame( frame ) | ||
local tabs = TabContainer.new( args | local tabs = TabContainer.new( args ) | ||
if args.left then | if args.left then | ||
local left = tabs:leftTabs( args.left | local left = tabs:leftTabs( args.left ) | ||
for _, leftArgs in ipairs( args.left ) do | for _, leftArgs in ipairs( args.left ) do | ||
tabArgs = leftArgs | tabArgs = leftArgs | ||
tabArgs.selection = leftArgs | tabArgs.selection = Args.getValue( leftArgs ) | ||
left:addTab( tabArgs ) | left:addTab( tabArgs ) | ||
end | end | ||
Line 195: | Line 195: | ||
if args.top then | if args.top then | ||
local topArgs = args.top | local topArgs = args.top | ||
if args.left and not topArgs.selector then topArgs.selector = 1 end -- default to 2D behavior if both sets are present | if args.left and not topArgs.selector then topArgs.selector = 1 end -- default to 2D behavior if both sets are present | ||
local top = tabs:topTabs( topArgs ) | local top = tabs:topTabs( topArgs ) | ||
for _, topArgs in ipairs( args.top ) do | for _, topArgs in ipairs( args.top ) do | ||
tabArgs = topArgs | tabArgs = topArgs | ||
tabArgs.selection = topArgs | tabArgs.selection = Args.getValue( topArgs ) | ||
top:addTab( tabArgs ) | top:addTab( tabArgs ) | ||
end | end | ||
end | end | ||
for | for contentId, contentArgs in pairs( args.content or {} ) do -- order doesn't matter here since only one is displayed at a time | ||
contentArgs = Args.getTable( contentArgs ) | |||
contentArgs.contentId = | contentArgs.contentId = contentId | ||
contentArgs.content = | contentArgs.content = Args.getValue( contentArgs ) | ||
tabs:addContent( contentArgs ) | tabs:addContent( contentArgs ) | ||
end | end |