schematic-symbols 0.0.101 → 0.0.104

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/dist/index.d.ts +5 -1
  2. package/dist/index.js +3462 -2207
  3. package/dist/index.js.map +1 -1
  4. package/drawing/arc.ts +1 -1
  5. package/drawing/cubicBezierCurveArc.ts +28 -0
  6. package/drawing/svgPathToPoints.ts +15 -5
  7. package/package.json +1 -1
  8. package/symbols/SPDT_switch_horz.ts +1 -0
  9. package/symbols/SPST_switch_horz.ts +10 -18
  10. package/symbols/capacitor_polarized_down.ts +10 -0
  11. package/symbols/capacitor_polarized_left.ts +10 -0
  12. package/symbols/capacitor_polarized_right.ts +10 -0
  13. package/symbols/capacitor_polarized_up.ts +10 -0
  14. package/symbols/constant_current_diode_horz.ts +7 -17
  15. package/symbols/constant_current_diode_vert.ts +9 -18
  16. package/symbols/crystal_horz.ts +7 -31
  17. package/symbols/crystal_vert.ts +9 -9
  18. package/symbols/darlington_pair_transistor_horz.ts +8 -19
  19. package/symbols/darlington_pair_transistor_vert.ts +11 -3
  20. package/symbols/dc_ammeter_horz.ts +3 -3
  21. package/symbols/dc_voltmeter_horz.ts +2 -2
  22. package/symbols/diac_horz.ts +7 -17
  23. package/symbols/diac_vert.ts +0 -1
  24. package/symbols/diode_right.ts +0 -1
  25. package/symbols/dpst_switch_horz.ts +1 -0
  26. package/symbols/filled_diode_horz.ts +7 -30
  27. package/symbols/frequency_meter_horz.ts +3 -3
  28. package/symbols/ground_vert.ts +0 -3
  29. package/symbols/gunn_diode_horz.ts +7 -21
  30. package/symbols/gunn_diode_vert.ts +10 -11
  31. package/symbols/igbt_transistor_horz.ts +8 -31
  32. package/symbols/illuminated_push_button_normally_open_horz.ts +7 -18
  33. package/symbols/laser_diode_horz.ts +8 -17
  34. package/symbols/npn_bipolar_transistor_horz.ts +8 -29
  35. package/symbols/npn_bipolar_transistor_vert.ts +10 -1
  36. package/symbols/photodiode_horz.ts +7 -30
  37. package/symbols/pnp_bipolar_transistor_horz.ts +8 -31
  38. package/symbols/pnp_bipolar_transistor_vert.ts +10 -2
  39. package/symbols/power_factor_meter_horz.ts +4 -4
  40. package/symbols/power_factor_meter_vert.ts +5 -2
  41. package/symbols/push_button_normally_closed_momentary_horz.ts +6 -4
  42. package/symbols/push_button_normally_closed_momentary_vert.ts +1 -20
  43. package/symbols/push_button_normally_open_momentary_horz.ts +6 -4
  44. package/symbols/push_button_normally_open_momentary_vert.ts +1 -20
  45. package/symbols/schottky_diode_horz.ts +2 -2
  46. package/symbols/silicon_controlled_rectifier_horz.ts +8 -16
  47. package/symbols/step_recovery_diode_horz.ts +7 -29
  48. package/symbols/tachometer_horz.ts +3 -3
  49. package/symbols/triac_horz.ts +8 -16
  50. package/symbols/var_meter_horz.ts +3 -3
  51. package/symbols/varmeter_horz.ts +3 -3
  52. package/symbols/volt_meter_horz.ts +7 -28
  53. package/symbols/watt_hour_meter_horz.ts +3 -3
  54. package/symbols/wattmeter_horz.ts +3 -3
@@ -1,19 +1,10 @@
1
- import { defineSymbol } from "drawing/defineSymbol"
2
1
  import svgJson from "assets/generated/laser_diode.json"
2
+ import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
3
 
4
- const { paths, texts, bounds, refblocks, circles } = svgJson
5
-
6
- export default defineSymbol({
7
- primitives: [
8
- ...Object.values(paths),
9
- ...Object.values(circles),
10
- { ...texts.top1, anchor: "middle_left" },
11
- { ...texts.bottom1, anchor: "middle_bottom" },
12
- ] as any,
13
- ports: [
14
- { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
15
- { ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
16
- ],
17
- size: { width: bounds.width, height: bounds.height },
18
- center: { x: bounds.centerX, y: bounds.centerY },
19
- })
4
+ svgJson.bounds.width += 0.2
5
+ export default modifySymbol(svgJson)
6
+ .changeTextAnchor("{VAL}", "middle_top")
7
+ .labelPort("left1", ["1"])
8
+ .labelPort("right1", ["2"])
9
+ .changeTextAnchor("{REF}", "middle_bottom")
10
+ .build()
@@ -1,32 +1,11 @@
1
1
  import svgJson from "assets/generated/npn_bipolar_transistor.json"
2
- import { defineSymbol } from "drawing/defineSymbol"
2
+ import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
3
 
4
4
  const { paths, texts, bounds, refblocks, circles } = svgJson
5
-
6
- export default defineSymbol({
7
- primitives: [
8
- ...Object.values(paths),
9
- ...Object.values(circles),
10
- {
11
- type: "text",
12
- text: "{REF}",
13
- x: -0.07,
14
- y: -0.3596647999999991,
15
- anchor: "middle_right",
16
- },
17
- {
18
- type: "text",
19
- text: "{VAL}",
20
- x: -0.0679100444999996,
21
- y: 0.4129789000000006,
22
- anchor: "middle_right",
23
- },
24
- ] as any,
25
- ports: [
26
- { ...refblocks.top1, labels: ["1", "collector"] },
27
- { ...refblocks.bottom1, labels: ["2", "emitter"] },
28
- { ...refblocks.left1, labels: ["3", "base"] },
29
- ],
30
- size: { width: bounds.width, height: bounds.height },
31
- center: { x: bounds.centerX, y: bounds.centerY },
32
- })
5
+ export default modifySymbol(svgJson)
6
+ .changeTextAnchor("{VAL}", "middle_right")
7
+ .labelPort("left1", ["3"])
8
+ .labelPort("top1", ["2"])
9
+ .labelPort("bottom1", ["1"])
10
+ .changeTextAnchor("{REF}", "middle_right")
11
+ .build()
@@ -1,5 +1,7 @@
1
1
  import { rotateSymbol } from "drawing/rotateSymbol"
2
+ import svgJson from "assets/generated/npn_bipolar_transistor.json"
2
3
  import npn_bipolar_transistor_horz from "./npn_bipolar_transistor_horz"
4
+ import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
5
 
4
6
  const rotatedSymbol = rotateSymbol(npn_bipolar_transistor_horz)
5
7
 
@@ -9,4 +11,11 @@ const ref = texts.find((t) => t.text === "{REF}")!
9
11
 
10
12
  ref.anchor = "middle_left"
11
13
 
12
- export default rotatedSymbol
14
+ export default modifySymbol(svgJson)
15
+ .rotateRightFacingSymbol("down")
16
+ .changeTextAnchor("{VAL}", "middle_right")
17
+ .labelPort("left1", ["3"])
18
+ .labelPort("top1", ["2"])
19
+ .labelPort("bottom1", ["1"])
20
+ .changeTextAnchor("{REF}", "middle_left")
21
+ .build()
@@ -1,32 +1,9 @@
1
- import { defineSymbol } from "drawing/defineSymbol"
2
1
  import svgJson from "assets/generated/photodiode.json"
3
- import { TextPrimitive } from "drawing/types"
2
+ import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
4
3
 
5
- const { paths, texts, bounds, refblocks, circles } = svgJson
6
-
7
- export default defineSymbol({
8
- primitives: [
9
- ...Object.values(paths),
10
- ...Object.values(circles),
11
- {
12
- type: "text",
13
- text: "{REF}",
14
- x: -0.15,
15
- y: -0.20318344999999938,
16
- anchor: "middle_right",
17
- } as TextPrimitive,
18
- {
19
- type: "text",
20
- text: "{VAL}",
21
- x: -0.00984920000000078,
22
- y: 0.5,
23
- anchor: "middle_top",
24
- } as TextPrimitive,
25
- ] as any,
26
- ports: [
27
- { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
28
- { ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
29
- ],
30
- size: { width: bounds.width, height: bounds.height },
31
- center: { x: bounds.centerX, y: bounds.centerY },
32
- })
4
+ export default modifySymbol(svgJson)
5
+ .changeTextAnchor("{VAL}", "middle_top")
6
+ .labelPort("left1", ["1"])
7
+ .labelPort("right1", ["2"])
8
+ .changeTextAnchor("{REF}", "middle_bottom")
9
+ .build()
@@ -1,33 +1,10 @@
1
1
  import svgJson from "assets/generated/pnp_bipolar_transistor.json"
2
- import { defineSymbol } from "drawing/defineSymbol"
3
- import { Primitive } from "drawing/types"
2
+ import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
4
3
 
5
- const { paths, texts, bounds, refblocks, circles } = svgJson
6
-
7
- export default defineSymbol({
8
- primitives: [
9
- ...Object.values(paths),
10
- ...Object.values(circles),
11
- {
12
- type: "text",
13
- text: "{REF}",
14
- x: -0.07,
15
- y: -0.3596647999999991,
16
- anchor: "middle_right",
17
- },
18
- {
19
- type: "text",
20
- text: "{VAL}",
21
- x: -0.0679100444999996,
22
- y: 0.4129789000000006,
23
- anchor: "middle_right",
24
- },
25
- ] as Primitive[],
26
- ports: [
27
- { ...refblocks.top1, labels: ["1", "collector"] },
28
- { ...refblocks.bottom1, labels: ["2", "emitter"] },
29
- { ...refblocks.left1, labels: ["3", "base"] },
30
- ],
31
- size: { width: bounds.width, height: bounds.height },
32
- center: { x: bounds.centerX, y: bounds.centerY },
33
- })
4
+ export default modifySymbol(svgJson)
5
+ .changeTextAnchor("{VAL}", "middle_right")
6
+ .labelPort("left1", ["3"])
7
+ .labelPort("bottom1", ["2"])
8
+ .labelPort("top1", ["1"])
9
+ .changeTextAnchor("{REF}", "middle_right")
10
+ .build()
@@ -1,5 +1,7 @@
1
1
  import { rotateSymbol } from "drawing/rotateSymbol"
2
2
  import pnp_bipolar_transistor_horz from "./pnp_bipolar_transistor_horz"
3
+ import svgJson from "assets/generated/pnp_bipolar_transistor.json"
4
+ import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
5
 
4
6
  const rotatedSymbol = rotateSymbol(pnp_bipolar_transistor_horz)
5
7
 
@@ -8,5 +10,11 @@ const texts = rotatedSymbol.primitives.filter((p) => p.type === "text")
8
10
  const ref = texts.find((t) => t.text === "{REF}")!
9
11
 
10
12
  ref.anchor = "middle_left"
11
-
12
- export default rotatedSymbol
13
+ export default modifySymbol(svgJson)
14
+ .rotateRightFacingSymbol("down")
15
+ .changeTextAnchor("{VAL}", "middle_right")
16
+ .labelPort("left1", ["3"])
17
+ .labelPort("bottom1", ["2"])
18
+ .labelPort("top1", ["1"])
19
+ .changeTextAnchor("{REF}", "middle_left")
20
+ .build()
@@ -14,7 +14,7 @@ export default defineSymbol({
14
14
  text: "{REF}",
15
15
  x: -0.15,
16
16
  y: -0.42330070000000064,
17
- anchor: "middle_left",
17
+ anchor: "middle_top",
18
18
  },
19
19
  // { ...texts.bottom1, anchor: "middle_left" },
20
20
  {
@@ -22,15 +22,15 @@ export default defineSymbol({
22
22
  text: "{VAL}",
23
23
  x: -0.15,
24
24
  y: 0.42330070000000064,
25
- anchor: "middle_left",
25
+ anchor: "middle_bottom",
26
26
  },
27
27
  // { ...texts.left1, anchor: "middle_left" },
28
28
  {
29
29
  type: "text",
30
30
  text: "COS φ",
31
- x: -0.14,
31
+ x: 0,
32
32
  y: 0.014279000000000375,
33
- anchor: "middle-left",
33
+ anchor: "center",
34
34
  },
35
35
  ] as any,
36
36
  ports: [
@@ -9,8 +9,11 @@ const val = texts.find((t) => t.text === "{VAL}")!
9
9
  const text_cos = texts.find((t) => t.text === "COS φ")!
10
10
  ref.x = 0.35
11
11
  ref.y = 0
12
- val.x = -0.6
12
+ ref.anchor = "middle_left"
13
+ val.anchor = "middle_right"
14
+ val.x = -0.35
13
15
  val.y = 0
14
- text_cos.x = -0.1
16
+ text_cos.x = 0
15
17
  text_cos.y = 0
18
+ text_cos.anchor = "center"
16
19
  export default rotatedSymbol
@@ -1,14 +1,16 @@
1
1
  import { defineSymbol } from "drawing/defineSymbol"
2
2
  import svgJson from "assets/generated/push_button_normally_closed_momentary.json"
3
+ import { Primitive } from "drawing/types"
3
4
 
4
- const { paths, texts, bounds, refblocks } = svgJson
5
+ const { paths, texts, bounds, refblocks, circles } = svgJson
5
6
 
6
7
  export default defineSymbol({
7
8
  primitives: [
8
9
  ...Object.values(paths),
9
- { ...texts.top1, anchor: "middle_bottom" },
10
- { ...texts.bottom1, anchor: "middle_top" },
11
- ] as any,
10
+ ...Object.values(circles),
11
+ { ...texts.top1, anchor: "middle_left" },
12
+ { ...texts.bottom1, anchor: "middle_left" },
13
+ ] as Primitive[],
12
14
  ports: [
13
15
  { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
14
16
  { ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
@@ -1,23 +1,4 @@
1
1
  import { rotateSymbol } from "drawing/rotateSymbol"
2
2
  import push_button_normally_closed_momentary_horz from "./push_button_normally_closed_momentary_horz"
3
- import type { TextPrimitive } from "drawing"
4
3
 
5
- const rotated = rotateSymbol(push_button_normally_closed_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
4
+ export default rotateSymbol(push_button_normally_closed_momentary_horz, "up")
@@ -1,14 +1,16 @@
1
1
  import { defineSymbol } from "drawing/defineSymbol"
2
2
  import svgJson from "assets/generated/push_button_normally_open_momentary.json"
3
+ import { Primitive } from "drawing/types"
3
4
 
4
- const { paths, texts, bounds, refblocks } = svgJson
5
+ const { paths, texts, bounds, refblocks, circles } = svgJson
5
6
 
6
7
  export default defineSymbol({
7
8
  primitives: [
8
9
  ...Object.values(paths),
9
- { ...texts.top1, anchor: "middle_bottom" },
10
- { ...texts.bottom1, anchor: "middle_top" },
11
- ] as any,
10
+ ...Object.values(circles),
11
+ { ...texts.top1, anchor: "middle_left" },
12
+ { ...texts.bottom1, anchor: "middle_left" },
13
+ ] as Primitive[],
12
14
  ports: [
13
15
  { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
14
16
  { ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
@@ -1,23 +1,4 @@
1
1
  import { rotateSymbol } from "drawing/rotateSymbol"
2
2
  import push_button_normally_open_momentary_horz from "./push_button_normally_open_momentary_horz"
3
- import type { TextPrimitive } from "drawing"
4
3
 
5
- const rotated = rotateSymbol(push_button_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.1
18
- ref.y = ref.y
19
-
20
- val.x = val.x
21
- val.y = 0
22
-
23
- export default rotated
4
+ export default rotateSymbol(push_button_normally_open_momentary_horz, "up")
@@ -5,6 +5,6 @@ import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
5
5
  export default modifySymbol(svgJson)
6
6
  .labelPort("left1", ["1", "pos"])
7
7
  .labelPort("right1", ["2", "neg"])
8
- .changeTextAnchor("{VAL}", "middle_bottom")
9
- .changeTextAnchor("{REF}", "middle_top")
8
+ .changeTextAnchor("{VAL}", "middle_top")
9
+ .changeTextAnchor("{REF}", "middle_bottom")
10
10
  .build()
@@ -1,21 +1,13 @@
1
1
  import { defineSymbol } from "drawing/defineSymbol"
2
2
  import svgJson from "assets/generated/silicon_controlled_rectifier.json"
3
3
  import { TextPrimitive } from "drawing/types"
4
+ import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
4
5
 
5
6
  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
- { ...texts.bottom1, anchor: "middle_top" },
13
- ] as any,
14
- ports: [
15
- { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
16
- { ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
17
- { ...refblocks.bottom1, labels: ["3"] }, // TODO add more "standard" labels
18
- ],
19
- size: { width: bounds.width, height: bounds.height },
20
- center: { x: bounds.centerX, y: bounds.centerY },
21
- })
7
+ export default modifySymbol(svgJson)
8
+ .changeTextAnchor("{VAL}", "middle_top")
9
+ .labelPort("left1", ["1"])
10
+ .labelPort("right1", ["2"])
11
+ .labelPort("bottom1", ["3"])
12
+ .changeTextAnchor("{REF}", "middle_bottom")
13
+ .build()
@@ -1,33 +1,11 @@
1
1
  import { defineSymbol } from "drawing/defineSymbol"
2
2
  import svgJson from "assets/generated/step_recovery_diode.json"
3
+ import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
4
 
4
5
  const { paths, texts, bounds, refblocks, circles } = svgJson
5
-
6
- export default defineSymbol({
7
- primitives: [
8
- ...Object.values(paths),
9
- ...Object.values(circles),
10
- // { ...texts.top1, anchor: "middle_left" },
11
- // { ...texts.bottom1, anchor: "middle_left" },
12
- {
13
- type: "text",
14
- text: "{REF}",
15
- x: -0.0050250999999996715,
16
- y: -0.26884529999999884,
17
- anchor: "middle_bottom",
18
- },
19
- {
20
- type: "text",
21
- text: "{VAL}",
22
- x: -0.00011179999999999524,
23
- y: 0.2788453000000004,
24
- anchor: "middle_top",
25
- },
26
- ] as any,
27
- ports: [
28
- { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
29
- { ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
30
- ],
31
- size: { width: bounds.width, height: bounds.height },
32
- center: { x: bounds.centerX, y: bounds.centerY },
33
- })
6
+ export default modifySymbol(svgJson)
7
+ .changeTextAnchor("{VAL}", "middle_top")
8
+ .labelPort("left1", ["1"])
9
+ .labelPort("right1", ["2"])
10
+ .changeTextAnchor("{REF}", "middle_bottom")
11
+ .build()
@@ -12,16 +12,16 @@ export default defineSymbol({
12
12
  text: "{REF}",
13
13
  x: 0,
14
14
  y: -0.3594553499999995,
15
- anchor: "middle_bottom",
15
+ anchor: "middle_top",
16
16
  },
17
17
  {
18
18
  type: "text",
19
19
  text: "{VAL}",
20
20
  x: 0,
21
21
  y: 0.35,
22
- anchor: "middle_top",
22
+ anchor: "middle_bottom",
23
23
  },
24
- { ...texts.left1, anchor: "center", fontSize: 0.2 },
24
+ { ...texts.left1, y: 0.01, anchor: "center", fontSize: 0.2 },
25
25
  ] as any,
26
26
  ports: [
27
27
  { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
@@ -1,21 +1,13 @@
1
1
  import { defineSymbol } from "drawing/defineSymbol"
2
2
  import svgJson from "assets/generated/triac.json"
3
3
  import { TextPrimitive } from "drawing/types"
4
+ import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
4
5
 
5
6
  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" } as TextPrimitive,
12
- { ...texts.bottom1, anchor: "middle_top" } as TextPrimitive,
13
- ] as any,
14
- ports: [
15
- { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
16
- { ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
17
- { ...refblocks.bottom1, labels: ["3"] }, // TODO add more "standard" labels
18
- ],
19
- size: { width: bounds.width, height: bounds.height },
20
- center: { x: bounds.centerX, y: bounds.centerY },
21
- })
7
+ export default modifySymbol(svgJson)
8
+ .changeTextAnchor("{VAL}", "middle_top")
9
+ .labelPort("left1", ["1"])
10
+ .labelPort("right1", ["2"])
11
+ .labelPort("bottom1", ["3"])
12
+ .changeTextAnchor("{REF}", "middle_bottom")
13
+ .build()
@@ -11,15 +11,15 @@ export default defineSymbol({
11
11
  ...texts.top1,
12
12
  x: 0,
13
13
  y: -0.3594553499999995,
14
- anchor: "middle_bottom",
14
+ anchor: "middle_top",
15
15
  },
16
16
  {
17
17
  ...texts.bottom1,
18
18
  x: 0,
19
19
  y: 0.35,
20
- anchor: "middle_top",
20
+ anchor: "middle_bottom",
21
21
  },
22
- { ...texts.left1, x: -0.02, y: -0.02, fontSize: 0.2, anchor: "center" },
22
+ { ...texts.left1, x: -0.02, y: 0.01, fontSize: 0.2, anchor: "center" },
23
23
  ] as any,
24
24
  ports: [
25
25
  { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
@@ -12,16 +12,16 @@ export default defineSymbol({
12
12
  text: "{REF}",
13
13
  x: 0,
14
14
  y: -0.3594553499999995,
15
- anchor: "middle_bottom",
15
+ anchor: "middle_top",
16
16
  },
17
17
  {
18
18
  type: "text",
19
19
  text: "{VAL}",
20
20
  x: 0,
21
21
  y: 0.35,
22
- anchor: "middle_top",
22
+ anchor: "middle_bottom",
23
23
  },
24
- { ...texts.left1, anchor: "center", fontSize: 0.2 },
24
+ { ...texts.left1, anchor: "center", y: 0.02, fontSize: 0.2 },
25
25
  ] as any,
26
26
  ports: [
27
27
  { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
@@ -1,31 +1,10 @@
1
- import { defineSymbol } from "drawing/defineSymbol"
2
1
  import svgJson from "assets/generated/volt_meter.json"
2
+ import { modifySymbol } from "drawing/modify-symbol/modify-symbol"
3
3
 
4
4
  const { paths, texts, bounds, circles, refblocks } = svgJson
5
-
6
- export default defineSymbol({
7
- primitives: [
8
- ...Object.values(paths),
9
- ...Object.values(circles),
10
- {
11
- type: "text",
12
- text: "{REF}",
13
- x: 0,
14
- y: -0.3594553499999995,
15
- anchor: "middle_bottom",
16
- },
17
- {
18
- type: "text",
19
- text: "{VAL}",
20
- x: 0,
21
- y: 0.35,
22
- anchor: "middle_top",
23
- },
24
- ] as any,
25
- ports: [
26
- { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
27
- { ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
28
- ],
29
- size: { width: bounds.width, height: bounds.height },
30
- center: { x: bounds.centerX, y: bounds.centerY },
31
- })
5
+ export default modifySymbol(svgJson)
6
+ .changeTextAnchor("{VAL}", "middle_top")
7
+ .labelPort("left1", ["1"])
8
+ .labelPort("right1", ["2"])
9
+ .changeTextAnchor("{REF}", "middle_bottom")
10
+ .build()
@@ -12,16 +12,16 @@ export default defineSymbol({
12
12
  text: "{REF}",
13
13
  x: 0,
14
14
  y: -0.3594553499999995,
15
- anchor: "middle_bottom",
15
+ anchor: "middle_top",
16
16
  },
17
17
  {
18
18
  type: "text",
19
19
  text: "{VAL}",
20
20
  x: 0,
21
21
  y: 0.35,
22
- anchor: "middle_top",
22
+ anchor: "middle_bottom",
23
23
  },
24
- { ...texts.left1, anchor: "center", fontSize: 0.2 },
24
+ { ...texts.left1, anchor: "center", y: 0.01, fontSize: 0.2 },
25
25
  ] as any,
26
26
  ports: [
27
27
  { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
@@ -12,16 +12,16 @@ export default defineSymbol({
12
12
  text: "{REF}",
13
13
  x: 0,
14
14
  y: -0.3594553499999995,
15
- anchor: "middle_bottom",
15
+ anchor: "middle_top",
16
16
  },
17
17
  {
18
18
  type: "text",
19
19
  text: "{VAL}",
20
20
  x: 0,
21
21
  y: 0.35,
22
- anchor: "middle_top",
22
+ anchor: "middle_bottom",
23
23
  },
24
- { ...texts.left1, anchor: "center", fontSize: 0.3 },
24
+ { ...texts.left1, anchor: "center", y: 0.01, fontSize: 0.3 },
25
25
  ] as any,
26
26
  ports: [
27
27
  { ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels