Skip to content

Commit

Permalink
use apply_transform directly on lims (#1741)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbyrne authored and SimonDanisch committed Mar 15, 2022
1 parent c8d6e5a commit 4827f7f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/layouting/transformation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ function apply_transform(f, r::Rect)
ma_t = apply_transform(f, ma)
Rect(Vec(mi_t), Vec(ma_t .- mi_t))
end
function apply_transform(f::PointTrans, r::Rect)
mi = minimum(r)
ma = maximum(r)
mi_t = apply_transform(f, Point(mi))
ma_t = apply_transform(f, Point(ma))
Rect(Vec(mi_t), Vec(ma_t .- mi_t))
end

# ambiguity fix
apply_transform(f::typeof(identity), r::Rect) = r
apply_transform(f::NTuple{2, typeof(identity)}, r::Rect) = r
Expand Down
6 changes: 4 additions & 2 deletions src/makielayout/layoutables/axis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ function layoutable(::Type{<:Axis}, fig_or_scene::Union{Figure, Scene}; bbox = n
nearclip = -10_000f0
farclip = 10_000f0

left, bottom = Makie.apply_transform(t, Point(minimum(lims)))
right, top = Makie.apply_transform(t, Point(maximum(lims)))
tlims = Makie.apply_transform(t, lims)

left, bottom = minimum(tlims)
right, top = maximum(tlims)

leftright = xrev ? (right, left) : (left, right)
bottomtop = yrev ? (top, bottom) : (bottom, top)
Expand Down

0 comments on commit 4827f7f

Please sign in to comment.