-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Polylux Integration #492
Polylux Integration #492
Conversation
ba47a01
to
d751184
Compare
Wow, that's cool! What Polylux functions specifically should be made public? |
I had to replicate |
d751184
to
4b507e1
Compare
As a lower-level foundational graphics package, should cetz rely on higher-level slide packages like polylux and touying, especially when adding a polylux parameter to cetz's canvas? I remain skeptical. I feel that even if support for slides is to be added, it should be done by finding a way for cetz to extract a better interface. For example, adding a parameter "current subslide index" to canvas and letting polylux depend on cetz, rather than the other way around. For example, touying now supports the use of #import "@preview/touying:0.2.0": *
#import "@preview/cetz:0.2.0"
#(s.page-args.width = auto)
#(s.page-args.height = auto)
#(s.page-args.footer = none)
#let (init, slide) = utils.methods(s)
#show: init
#slide(repeat: 3, self => [
#let (only,) = utils.methods(self)
Current index: #self.subslide
#cetz.canvas({
import cetz.draw: *
rect((-1,-1), (1,1), fill: red)
only(2, circle((.5,.3), fill: blue))
only("2-3", {
line((.2,.1), (rel: (1,1.3)), (rel: (.7, -1.8)), fill: green, close: true)
content((0, -2), [Hello])
})
})
]) |
Like here: #251 (comment) |
Closing this as @johannes-wolf and I figured last night that CeTZ should not be the package containing the integrations/plugins from other packages. They should be in the integrating package or a separate package. We are working on making integrations easier in #494, @OrangeX4 and @andreasKroepelin please join us there to discuss. |
This PR adds integration for the Polylux module by @andreasKroepelin.
The code currently uses private functions from Polylux
logic.typ
, maybe those could be made public @andreasKroepelin (see/src/lib/polylux.typ
)?To use Polylux with CeTZ, the user has to pass the Polylux module to the canvas. This allows using different Polylux versions with CeTZ, without CeTZ having a dependency on Polylux.
For an example, see the test case.
The following Polylux functions are available from
cetz.polylux
:only
uncover
@fenjalien, to be able to modify state (counters) I've added a list of functions to
ctx
that get executed in thecanvas
function and allow returning content prior to the canvas block. Since the content returned by counter updates is not visible, this should be fine. I could not come up with a better solution.We could also implement this binding on the Polylux side.
With #494 there is a proof-of-concept for a plug-in API either Polylux or a package like
cetz-polylux
could use for providing the Polylux bindings.