Open fenjalien opened 7 months ago
~~The bbox of groups is currently axis aligned, which is intended. If we support rotated group bboxes, this has to be toggleable as a flag, because getting an axis aligned bbox is very useful.~~
As soon as nested anchors are merged, this example would be possible by using the rect instead of the group for anchor placement (https://github.com/johannes-wolf/cetz/pull/389).
EDIT: I think I got this wrong. Yes, if the transformation is outsides the group, its anchors should get transformed by that.
How should this work for groups containing elements with different z coordinates? If we do not “flatten” the bounding box to an aabb, we can not correctly generate bounding boxes for such groups.
Second problem are groups with content(..)
insides them. Content is not affected by transformations.
Example with content:
The cleanest solution would be to implement setting a transformation matrix in Typst and transforming text like any other element.
Hmm, I would rather not be transforming content until we get better control from Typst, otherwise it feels just to brittle and difficult to keep working.
My current work around is to hide a rectangle then copy its anchors, which works but does mean I have to calculate the bounds before hand and angle/path anchors don't work as expected. What might be an easier solution would be to allow completely overriding the anchors of a group.
The bounds anchors would be kept as default but it would require exposing anchor.setup
in some form...
All we need from Typst is it allowing to set a transformation matrix. Internally, it should use them already, so the missing part is a function to set one. Maybe we can make a PR for Typst implementing such function?
My current work around is to hide a rectangle then copy its anchors, which works but does mean I have to calculate the bounds before hand and angle/path anchors don't work as expected. What might be an easier solution would be to allow completely overriding the anchors of a group.
What do you mean with allowing to override anchors of groups? Isn't that possible?
In the example I would expect the red circle to cover the blue one