cetz
cetz copied to clipboard
[Feature Request] Extract x, y coordinates from anchors
I regularly find myself in situations where I need this and I don't think there is a way, I searched through the docs and wasn't able to find anything similar or a workaround. If it is already possible, please show me how.
There already is a way: let (_, vec) = cetz.coordinate.resolve(ctx, <your anchor>) returs the vector to vec.
Example:
get-ctx(ctx => {
let (_, vec) = cetz.coordinate.resolve(ctx, pt)
content(at, [#vec])
})
Thank you very much my friend.
~~Is there a way to add custom anchors? I'd like to allow for, say, the "circle.south.x" anchor to exist inside my canvas using this get-ctx function.~~ I just realized what I said makes no sense lol