Skip to content

Commit

Permalink
Merge branch 'master' into ff/Axis3-controls
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer authored Nov 15, 2024
2 parents 10b9d9c + 66c32da commit 14de291
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Fix an error in `convert_arguments` for PointBased plots and 3D polygons [#4585](https://github.com/MakieOrg/Makie.jl/pull/4585).
- Fix polygon rendering issue of `crossbar(..., show_notch = true)` in CairoMakie [#4587](https://github.com/MakieOrg/Makie.jl/pull/4587).
- Added translation, zoom and limit reset interactions to Axis3 [4131](https://github.com/MakieOrg/Makie.jl/pull/4131)
- Fix render order of Axis3 frame lines in CairoMakie [#4591](https://github.com/MakieOrg/Makie.jl/pull/4591)

## [0.21.16] - 2024-11-06

Expand Down
21 changes: 9 additions & 12 deletions src/makielayout/blocks/axis3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -469,26 +469,23 @@ function add_gridlines_and_frames!(topscene, scene, ax, dim::Int, limits, tickno
# we are going to transform the 3d frame points into 2d of the topscene
# because otherwise the frame lines can
# be cut when they lie directly on the scene boundary
to_topscene_z_2d.([p1, p2, p3, p4, p5, p6], Ref(scene))
o = scene.viewport[].origin
return map([p1, p2, p3, p4, p5, p6]) do p3d
# This strip z here (set it to 0) and translate to coerce z sorting
# to be correct in CairoMakie (which is based on plot.transformation)
return Point2f(o + Makie.project(scene, p3d))
end
end
colors = Observable{Any}()
map!(vcat, colors, attr(:spinecolor_1), attr(:spinecolor_2), attr(:spinecolor_3))
framelines = linesegments!(topscene, framepoints, color = colors, linewidth = attr(:spinewidth),
transparency = false, visible = attr(:spinesvisible), inspectable = false)
# -10000 is the far value in campixel
translate!(framelines, 0, 0, -10000)

return gridline1, gridline2, framelines
end

# this function projects a point from a 3d subscene into the parent space with a really
# small z value
function to_topscene_z_2d(p3d, scene)
o = scene.viewport[].origin
p2d = Point2f(o + Makie.project(scene, p3d))
# -10000 is an arbitrary weird constant that in preliminary testing didn't seem
# to clip into plot objects anymore
Point3f(p2d..., -10000)
end

function add_ticks_and_ticklabels!(topscene, scene, ax, dim::Int, limits, ticknode, miv, min1, min2, azimuth, xreversed, yreversed, zreversed)

dimsym(sym) = Symbol(string((:x, :y, :z)[dim]) * string(sym))
Expand Down Expand Up @@ -547,7 +544,7 @@ function add_ticks_and_ticklabels!(topscene, scene, ax, dim::Int, limits, tickno
ticks = linesegments!(topscene, tick_segments,
transparency = true, inspectable = false,
color = attr(:tickcolor), linewidth = attr(:tickwidth), visible = attr(:ticksvisible))
# move ticks behind plots
# move ticks behind plots, -10000 is the far value in campixel
translate!(ticks, 0, 0, -10000)

labels_positions = Observable{Any}()
Expand Down

0 comments on commit 14de291

Please sign in to comment.