fatteneder / MakieSlides.jl

MIT License
17 stars 2 forks source link

Introduce slide elements #31

Open fatteneder opened 2 years ago

fatteneder commented 2 years ago

Add basic features needed to complete #13

This version here basically splits the current foreground figure figure of Presentation into multiple elements, header, footer, body, sidebar_lhs, sidebar_rhs. I choose this over putting header, footer, sidebar_lhs, sidebar_rhs into the background figure parent in Presentation, because I anticipate that we also need to redraw those frequently, e.g. when we add slide number support.

You can now create slides with

new_slide!(pres)
add_to_slide!(pres, element=:header) do fig
   # ...
end

Note that I replaced add_slide! with new new_slide! and add_to_slide!.

For now the elements are created for all elements. I can imagine that we later start every new_slide! with no elements present and then allow to add a header or footer element dynamically and on a slide by slide basis.

fatteneder commented 2 years ago

For now the elements are created for all elements. I can imagine that we later start every new_slide! with no elements present and then allow to add a header or footer element dynamically and on a slide by slide basis.

Ok, I got this to work by diving into internals of GridLayoutBase. Not sure how reliable that is, though. Also: The SlideElement struct I introduced reassembles GridLayoutBase.GridContent. Perhaps parts of this PR could be elivated to GridLayoutBase at some point?