register-coordinate-resolver
register-coordinate-resolver()
Push a custom coordinate resolve function to the list of coordinate resolvers. This resolver is scoped to the current context scope!
A coordinate resolver must be a function of the format (context, coordinate) => coordinate. And must always return a valid coordinate or panic, in case of an error.
If multiple resolvers are registered, coordinates get passed through all resolvers in reverse registering order. All coordinates get paased to cetz' default coordinate resolvers.
register-coordinate-resolver((ctx, c) => {
if type(c) == dictionary and "log" in c {
c = c.log.map(n => calc.log(n, base: 10))
}
return c
})
circle((log: (10, 1e-6)), radius: .25)
circle((log: (100, 1e-6)), radius: .25)
circle((log: (1000, 1e-6)), radius: .25)