Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

colsizes does not support a mixed vector without trickery #56

Open
asinghvi17 opened this issue Apr 14, 2024 · 1 comment
Open

colsizes does not support a mixed vector without trickery #56

asinghvi17 opened this issue Apr 14, 2024 · 1 comment

Comments

@asinghvi17
Copy link
Contributor

Trying to create a GridLayout like so,

GridLayout(5, 3; colsizes = [Relative(0.1), Relative(0.5), Relative(0.4)])

works fine, but if I try to pass a mixture of size types into colsizes,

GridLayout(1, 3; colsizes = [Fixed(5), Auto(), Fixed(5)])

I get an error:

ERROR: Illegal sizes value Any[Fixed(5.0f0), Auto(true, 1.0f0), Fixed(5.0f0)]

I can fix this by strictly typing the array as a Vector{Makie.GridLayoutBase.ContentSize}, but that seems inefficient and is impossible for users to discover since there's no documentation about it.

Potential solutions to this are:

  • Perform explicit vector type unioning in convert_contentsizes(n::Int64, sizes::Vector{Any}) (found at src/gridlayout.jl:332) and check the result of that in order to convert/dispatch.
  • Set Fixed, Auto, Relative, etc. to have a supertype AbstractSize or something, which will make at least this syntax pass (passing real numbers will not, that'll probably still need the explicit vector type union)
@jkrumbiegel
Copy link
Owner

Yeah the vector needs a convert, so the first option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants