added name anchor to ALU
This commit is contained in:
		| @@ -24,6 +24,7 @@ | ||||
|     draw.anchor("south", (p2, 50%, p3)) | ||||
|     draw.anchor("west", (p0, 50%, p3)) | ||||
|     draw.anchor("east", (p1, 50%, p2)) | ||||
|     draw.anchor("name", (p5, 50%, (p1, 50%, p2))) | ||||
|   }) | ||||
|  | ||||
|   let f2 = add-port(id, "west", (id: "in1"), (p0, 50%, p6)) | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| #import "@preview/cetz:0.2.2": draw, coordinate | ||||
| #import "ports.typ": add-ports, add-port | ||||
| #import "../util.typ" | ||||
|  | ||||
| #let find-port(ports, id) = { | ||||
|   for (side, side-ports) in ports { | ||||
| @@ -115,7 +116,7 @@ | ||||
|   if (name != none) { | ||||
|     draw.content( | ||||
|       (name: id, anchor: name-anchor), | ||||
|       anchor: name-anchor, | ||||
|       anchor: if name-anchor in util.valid-anchors {name-anchor} else {"center"}, | ||||
|       padding: 0.5em, | ||||
|       align(center)[*#name*] | ||||
|     ) | ||||
|   | ||||
| @@ -68,4 +68,9 @@ | ||||
|     south-east: "south-west", | ||||
|     south-west: "north-west" | ||||
|   ).at(anchor) | ||||
| } | ||||
| } | ||||
|  | ||||
| #let valid-anchors = ( | ||||
|   "center", "north", "east", "west", "south", | ||||
|   "north-east", "north-west", "south-east", "south-west" | ||||
| ) | ||||
		Reference in New Issue
	
	Block a user