cetz-package / cetz

CeTZ: ein Typst Zeichenpaket - A library for drawing stuff with Typst.
https://cetz-package.github.io
GNU Lesser General Public License v3.0
733 stars 34 forks source link

mark: Add anchor style to shift marks #584

Closed johannes-wolf closed 1 month ago

johannes-wolf commented 1 month ago

@fenjalien Not sure about the name origin. The idea is to have a style key that shifts the mark origin along its (local) x-axis: 0% tip, 100% base.

Fixes #578.

fenjalien commented 1 month ago

Would it be easier to add anchors to the mark function? "tip", "center" and "inset" (or "base") could work

johannes-wolf commented 1 month ago

Would it be easier to add anchors to the mark function? "tip", "center" and "inset" (or "base") could work

As an addition? Because this feature is also useful when placing a mark on a path, e.g., in the center.

fenjalien commented 1 month ago

No, instead of using the origin styling parameter. Anchors would functionally do the same thing but with predefined positions. Given the normal size of marks I don't think you would want such fine control it.

arkadiuszwojcik commented 1 month ago

@fenjalien in such case how it would look like if I would like to use mark center as placement origin?

johannes-wolf commented 1 month ago

mark(..., anchor: "center"), I guess.

johannes-wolf commented 1 month ago

Changed. You can now specify one of the anchors tip, center and base to place the mark at. This also works with marks on paths.

johannes-wolf commented 1 month ago

Can we merge this?