schematic-symbols 0.0.109 → 0.0.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.109",
4
+ "version": "0.0.111",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -3,8 +3,8 @@ import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
3
 
4
4
  export default modifySymbol(svgJson)
5
5
  .rotateRightFacingSymbol("right")
6
- .changeTextAnchor("{VAL}", "middle_right")
6
+ .changeTextAnchor("{VAL}", "middle_top")
7
7
  .labelPort("left1", ["1"])
8
8
  .labelPort("right1", ["2"])
9
- .changeTextAnchor("{REF}", "middle_left")
9
+ .changeTextAnchor("{REF}", "middle_bottom")
10
10
  .build()
@@ -0,0 +1,26 @@
1
+ import { defineSymbol } from "drawing/defineSymbol"
2
+ import svgJson from "assets/generated/dpdt_switch.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" },
12
+ { ...texts.bottom1, anchor: "middle_top" },
13
+ ] as Primitive[],
14
+
15
+ ports: [
16
+ { ...refblocks.left1, labels: ["1"] },
17
+ { ...refblocks.left2, labels: ["4"] },
18
+ { ...refblocks.right1, labels: ["3"] },
19
+ { ...refblocks.right2, labels: ["2"] },
20
+ { ...refblocks.right3, labels: ["6"] },
21
+ { ...refblocks.right5, labels: ["5"] },
22
+ ],
23
+
24
+ size: { width: bounds.width, height: bounds.height },
25
+ center: { x: bounds.centerX, y: bounds.centerY },
26
+ })
@@ -0,0 +1,20 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import dpdp_switch_horz from "./dpdt_switch_horz"
3
+
4
+ const rotatedSymbol = rotateSymbol(dpdp_switch_horz)
5
+
6
+ const texts = rotatedSymbol.primitives.filter((p) => p.type === "text")!
7
+
8
+ const val = texts.find((t) => t.text === "{VAL}")!
9
+
10
+ val.anchor = "middle_right"
11
+ val.x = -0.37
12
+ val.y = 0.12
13
+
14
+ const ref = texts.find((t) => t.text === "{REF}")!
15
+
16
+ ref.anchor = "middle_left"
17
+ ref.x = 0.37
18
+ ref.y = 0.12
19
+
20
+ export default rotatedSymbol