Skip to content
Snippets Groups Projects
Commit 39bb8b6b authored by Albin Heimerson's avatar Albin Heimerson
Browse files

add gridcreation with %

parent d756f323
No related branches found
No related tags found
1 merge request!1WIP: fixes for julia1
...@@ -9,6 +9,18 @@ function make_row(columns::Integer) ...@@ -9,6 +9,18 @@ function make_row(columns::Integer)
(Node(:div, style=style, "Lorem Ipsum") for i in 1:columns) (Node(:div, style=style, "Lorem Ipsum") for i in 1:columns)
end end
function make_row(columns::Vector)
#Returns tuple, needs to be Node(:div, tuple..) before use
style = Dict(:display => "inline-table",
:verticalAlign => "top",
:width => "$(100/columns)%")
#:transform => "scale($(1/columns))")
(Node(:div, style=Dict(:display => "inline-table",
:verticalAlign => "top",
:width => "$(column)%"),
"Lorem Ipsum") for column in columns)
end
""" """
Constructs a Node containing empty nodes in a row by column grid. A member can then be accessed using [n,m] syntax, but [n][m] accesses the element container; [n][m][1] is equivalent to [n,m]. This is done to maintain the style (width etc) of the subelements. Constructs a Node containing empty nodes in a row by column grid. A member can then be accessed using [n,m] syntax, but [n][m] accesses the element container; [n][m][1] is equivalent to [n,m]. This is done to maintain the style (width etc) of the subelements.
...@@ -21,6 +33,14 @@ function make_grid(rows::Integer, columns::Integer, width = 500, height = 800) ...@@ -21,6 +33,14 @@ function make_grid(rows::Integer, columns::Integer, width = 500, height = 800)
for i in 1:rows)...) for i in 1:rows)...)
end end
function make_grid(rows::Vector, columns::Vector, width = 500, height = 800)
style_grid = Dict(:width => width, :height => height)
Node(:div, style=style_grid, (Node(:div, style=Dict(:height => "$(row)%",
:overflow => "auto"),
make_row(columns)...)
for row in rows)...)
end
function Base.getindex(grid::WebIO.Node{WebIO.DOM}, ind::Integer) function Base.getindex(grid::WebIO.Node{WebIO.DOM}, ind::Integer)
grid.children[ind] grid.children[ind]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment