forked from HEL/circuiteria
		
	improve default-draw-shape by drawing a rectangle
This commit is contained in:
		| @@ -3,40 +3,20 @@ | |||||||
| #import "../element.typ" | #import "../element.typ" | ||||||
|  |  | ||||||
| #let default-draw-shape(id, tl, tr, br, bl, fill, stroke, symbol) = { | #let default-draw-shape(id, tl, tr, br, bl, fill, stroke, symbol) = { | ||||||
|   let (x, y) = bl |   let shapes = draw.rect( | ||||||
|   let (width, height) = (tr.at(0) - x, tr.at(1) - y) |  | ||||||
|  |  | ||||||
|   let t = (x + width / 2, y + height) |  | ||||||
|   let b = (x + width / 2, y) |  | ||||||
|  |  | ||||||
|   let f = draw.group( |  | ||||||
|     name: id, |  | ||||||
|     { |  | ||||||
|       draw.merge-path( |  | ||||||
|     inset: 0.5em, |     inset: 0.5em, | ||||||
|     fill: fill, |     fill: fill, | ||||||
|     stroke: stroke, |     stroke: stroke, | ||||||
|         name: id + "-path", |     name: id, | ||||||
|         close: true, |     bl, tr | ||||||
|         { |  | ||||||
|           draw.line(bl, tl, tr, br) |  | ||||||
|         }, |  | ||||||
|   ) |   ) | ||||||
|  |   shapes += draw.content( | ||||||
|       draw.content( |     id + ".center", | ||||||
|         (x + width / 2, y + height / 2), |     [*$ symbol $*] | ||||||
|         padding: 0.5em, |  | ||||||
|         align(center)[*$ symbol $*], |  | ||||||
|   ) |   ) | ||||||
|  |   return (shapes, tl, tr, br, bl) | ||||||
|       draw.anchor("north", t)  |  | ||||||
|       draw.anchor("south", b) |  | ||||||
|     }, |  | ||||||
|   ) |  | ||||||
|   return (f, tl, tr, br, bl) |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| /// Draws a logic gate. This function is also available as `element.iec-gate()` | /// Draws a logic gate. This function is also available as `element.iec-gate()` | ||||||
| /// | /// | ||||||
| /// - draw-shape (function): see #doc-ref("element.elmt") | /// - draw-shape (function): see #doc-ref("element.elmt") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user