schematic-symbols 0.0.41 → 0.0.42

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.41",
4
+ "version": "0.0.42",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -0,0 +1,42 @@
1
+ import { defineSymbol } from "drawing/defineSymbol"
2
+ import svgJson from "assets/generated/power_factor_meter.json"
3
+ import { ninePointAnchorToSvgAnchor } from "drawing/ninePointAnchorToSvgAnchor"
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_left" },
12
+ {
13
+ type: "text",
14
+ text: "{REF}",
15
+ x: -0.15,
16
+ y: -0.42330070000000064,
17
+ anchor: "middle_left",
18
+ },
19
+ // { ...texts.bottom1, anchor: "middle_left" },
20
+ {
21
+ type: "text",
22
+ text: "{VAL}",
23
+ x: -0.15,
24
+ y: 0.42330070000000064,
25
+ anchor: "middle_left",
26
+ },
27
+ // { ...texts.left1, anchor: "middle_left" },
28
+ {
29
+ type: "text",
30
+ text: "COS φ",
31
+ x: -0.14,
32
+ y: 0.014279000000000375,
33
+ anchor: "middle-left",
34
+ },
35
+ ] as any,
36
+ ports: [
37
+ { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
38
+ { ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
39
+ ],
40
+ size: { width: bounds.width, height: bounds.height },
41
+ center: { x: bounds.centerX, y: bounds.centerY },
42
+ })
@@ -0,0 +1,16 @@
1
+ import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import power_factor_meter_horz from "./power_factor_meter_horz"
3
+ import { text } from "drawing/text"
4
+
5
+ const rotatedSymbol = rotateSymbol(power_factor_meter_horz)
6
+ const texts = rotatedSymbol.primitives.filter((p) => p.type === "text")
7
+ const ref = texts.find((t) => t.text === "{REF}")!
8
+ const val = texts.find((t) => t.text === "{VAL}")!
9
+ const text_cos = texts.find((t) => t.text === "COS φ")!
10
+ ref.x = 0.35
11
+ ref.y = 0
12
+ val.x = -0.6
13
+ val.y = 0
14
+ text_cos.x = -0.1
15
+ text_cos.y = 0
16
+ export default rotatedSymbol