forked from HEL/circuiteria
		
	split up sources into manageable files
This commit is contained in:
		
							
								
								
									
										46
									
								
								src/elements/block.typ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								src/elements/block.typ
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | ||||
| #import "@preview/cetz:0.2.2": draw | ||||
| #import "element.typ" | ||||
|  | ||||
| #let draw-shape(id, tl, tr, br, bl, fill, stroke) = { | ||||
|   let f = draw.rect( | ||||
|     radius: 0.5em, | ||||
|     inset: 0.5em, | ||||
|     fill: fill, | ||||
|     stroke: stroke, | ||||
|     name: id, | ||||
|     bl, tr | ||||
|   ) | ||||
|   return (f, tl, tr, br, bl) | ||||
| } | ||||
|  | ||||
| #let block( | ||||
|   x: none, | ||||
|   y: none, | ||||
|   w: none, | ||||
|   h: none, | ||||
|   name: none, | ||||
|   name-anchor: "center", | ||||
|   ports: (), | ||||
|   ports-margins: (), | ||||
|   fill: none, | ||||
|   stroke: black + 1pt, | ||||
|   id: "", | ||||
|   debug: ( | ||||
|     grid: false, | ||||
|     ports: false | ||||
|   ) | ||||
| ) = element.elmt( | ||||
|   draw-shape: draw-shape, | ||||
|   x: x, | ||||
|   y: y, | ||||
|   w: w, | ||||
|   h: h, | ||||
|   name: name, | ||||
|   name-anchor: name-anchor, | ||||
|   ports: ports, | ||||
|   ports-margins: ports-margins, | ||||
|   fill: fill, | ||||
|   stroke: stroke, | ||||
|   id: id, | ||||
|   debug: debug | ||||
| ) | ||||
		Reference in New Issue
	
	Block a user