Skip to content

Commit

Permalink
fix #4912
Browse files Browse the repository at this point in the history
  • Loading branch information
BeastyBlacksmith committed Apr 11, 2024
1 parent b1f5e77 commit 7a8f56f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/layouts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,23 +216,28 @@ function GridLayout(
kw...,
)
# Check the values for heights and widths if values are provided
if heights !== nothing && widths !== nothing
if heights !== nothing
if sum(heights) != 1
error("The sum of heights must be 1!")
end
if all(x -> 0 < x < 1, heights) == false
error("Values for heights must be in the range (0, 1)!")
end
else
heights = zeros(dims[1])
end
if widths !== nothing

if sum(widths) != 1
error("The sum of widths must be 1!")
end
if all(x -> 0 < x < 1, widths) == false
error("Values for widths must be in the range (0, 1)!")
end
if all(x -> 0 < x < 1, heights) == false
error("Values for heights must be in the range (0, 1)!")
end
else
heights = zeros(dims[1])
widths = zeros(dims[2])
end

grid = Matrix{AbstractLayout}(undef, dims...)
layout = GridLayout(
parent,
Expand Down

0 comments on commit 7a8f56f

Please sign in to comment.