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
809 stars 35 forks source link

Replace any occurrence of `nodes` by `elements` #229

Open TimotheAlbouy opened 11 months ago

TimotheAlbouy commented 11 months ago

To quote fenjalien in a Discord thread:

cetz doesn't actually have "nodes" as there aren't any "paths" everything is an "element" ctx.nodes exists because we haven't bothered to change the name :/

I don't really understand what it entails and what are the exact distinctions, but I believe that generally speaking, having a unified notation helps for maintenance and understanding of the code.

TimotheAlbouy commented 11 months ago

In fact, the ctx.nodes attribute contains only the element anchors, as currently, only the anchors are used from the context in CetZ, so maybe it should be renamed to ctx.element_anchors instead.

But given that we will probably need the full elements (and not just their anchors) to be stored in the context to do things such as calculating the intersections between some elements, then maybe we should rename the attribute to ctx.elements and change what is stored in it. This would perhaps incur some significant refactoring unfortunately.