Jollywatt / typst-fletcher

Typst package for drawing diagrams with arrows, built on top of CeTZ.
MIT License
270 stars 6 forks source link

compute missing aspect property when the dimensions are given #4

Closed SillyFreak closed 5 months ago

SillyFreak commented 5 months ago

Example demonstrating the problem being solved:

#import "@preview/fletcher:0.4.0" as fletcher: node, edge

#fletcher.diagram({
  node((0, 0), width: 2em, height: 2em, stroke: 1pt, [a])
  edge("r")
  node((1, 0), shape: "rect", radius: 1em, stroke: 1pt, [a])
})

If both width and height are given, or radius is given but a rectangle shape is forced, then the get-node-anchor function needs the aspect property but it will be missing. This commit fixes the issue.

Jollywatt commented 5 months ago

Nice, thanks!