Skip to content

Commit

Permalink
fix scene tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch committed Jul 31, 2023
1 parent 0168191 commit 2e3570b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/tutorials/scenes.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ We can fix this by translating the scene further back:
\begin{examplefigure}{}
```julia
GLMakie.activate!() # hide
translate!(scene.plots[1], 0, 0, -1000)
translate!(scene.plots[1], 0, 0, -10000)
scene
```
\end{examplefigure}
Expand Down
19 changes: 7 additions & 12 deletions src/scenes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -332,17 +332,12 @@ function Scene(
)
if isnothing(px_area)
map!(identity, child_px_area, parent.px_area)
elseif !(px_area isa Observable)
# this can't have been working before, since the `on` didn't update anything
#=
old code instead of error!
a = Rect2i(px_area)
on(child, pixelarea(parent)) do p
# make coordinates relative to parent
return Rect2i(minimum(p) .+ minimum(a), widths(a)) # doesn't do anything!!
end
=#
error("Not implemented")
elseif px_area isa Rect2
child_px_area[] = Rect2i(px_area)
else
if !(px_area isa Observable)
error("px_area must be an Observable{Rect2} or a Rect2")
end
end
push!(parent.children, child)
child.parent = parent
Expand Down Expand Up @@ -395,7 +390,7 @@ struct OldAxis end
zero_origin(area) = Recti(0, 0, widths(area))

function child(scene::Scene; camera, attributes...)
return Scene(scene, lift(zero_origin, pixelarea(scene)); camera=camera, attributes...)
return Scene(scene; camera=camera, attributes...)
end

"""
Expand Down

0 comments on commit 2e3570b

Please sign in to comment.