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

Relax align typing for Blocks #2108

Merged
merged 4 commits into from Jul 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
@@ -1,5 +1,9 @@
# News

## master

- Fixed regression where `Block` alignments could not be specified as numbers anymore [#2108](https://github.com/JuliaPlots/Makie.jl/pull/2108).

## v0.17.7

- Improved `Menu` performance, now it should me much harder to reach the boundary of 255 scenes in GLMakie. `Menu` also takes a `default` keyword argument now and can be scrolled if there is too little space available.
Expand Down
4 changes: 2 additions & 2 deletions src/makielayout/blocks.jl
Expand Up @@ -332,8 +332,8 @@ function _block(T::Type{<:Block}, fig_or_scene::Union{Figure, Scene},
layout_height = Observable{Any}(nothing)
layout_tellwidth = Observable(true)
layout_tellheight = Observable(true)
layout_halign = Observable(:center)
layout_valign = Observable(:center)
layout_halign = Observable{Union{Symbol, Float64}}(:center)
layout_valign = Observable{Union{Symbol, Float64}}(:center)
layout_alignmode = Observable{Any}(Inside())

lobservables = LayoutObservables(
Expand Down
10 changes: 10 additions & 0 deletions test/makielayout.jl
Expand Up @@ -175,3 +175,13 @@ end
ax = Axis(f[1,1], xticks = 20:10:80)
scatter!(ax, 30:10:100, rand(Float64, 8), color = :red)
end

# issues 1958 and 2006
@testset "axislegend number align" begin
f = Figure()
ax = Axis(f[1,1], xticks = 20:10:80)
lines!(ax, 1:10, label = "A line")
leg = axislegend(ax, position = (0.4, 0.8))
@test leg.halign[] == 0.4
@test leg.valign[] == 0.8
end