schematic-symbols 0.0.74 → 0.0.75

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "schematic-symbols",
3
3
  "main": "./dist/index.js",
4
- "version": "0.0.74",
4
+ "version": "0.0.75",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -0,0 +1,20 @@
1
+ import { defineSymbol } from "drawing/defineSymbol"
2
+ import svgJson from "assets/generated/mushroom_head_normally_open_momentary.json"
3
+ import { Primitive } from "drawing/types"
4
+
5
+ const { paths, texts, bounds, refblocks, circles } = svgJson
6
+
7
+ export default defineSymbol({
8
+ primitives: [
9
+ ...Object.values(paths),
10
+ ...Object.values(circles),
11
+ { ...texts.top1, anchor: "middle_bottom", x: 0 },
12
+ { ...texts.bottom1, anchor: "middle_top", x: 0 },
13
+ ] as Primitive[],
14
+ ports: [
15
+ { ...refblocks.left1, labels: ["1"] },
16
+ { ...refblocks.right1, labels: ["2"] },
17
+ ],
18
+ size: { width: bounds.width, height: bounds.height },
19
+ center: { x: bounds.centerX + 0.006, y: bounds.centerY + 0.06 },
20
+ })
@@ -0,0 +1,23 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import mushroom_head_normally_open_momentary_horz from "./mushroom_head_normally_open_momentary_horz"
3
+ import type { TextPrimitive } from "drawing"
4
+
5
+ const rotated = rotateSymbol(mushroom_head_normally_open_momentary_horz)
6
+
7
+ const ref = rotated.primitives.find(
8
+ (p) => p.type === "text" && p.text === "{REF}",
9
+ )! as TextPrimitive
10
+ const val = rotated.primitives.find(
11
+ (p) => p.type === "text" && p.text === "{VAL}",
12
+ )! as TextPrimitive
13
+
14
+ ref.anchor = "middle_left"
15
+ val.anchor = "middle_right"
16
+
17
+ ref.x = ref.x - 0.03
18
+ ref.y = ref.y
19
+
20
+ val.x = val.x
21
+ val.y = 0
22
+
23
+ export default rotated