schematic-symbols 0.0.94 → 0.0.95
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +4 -2
- package/dist/index.js +254 -256
- package/dist/index.js.map +1 -1
- package/drawing/rotateSymbol.ts +4 -4
- package/package.json +1 -1
- package/symbols/led_down.ts +4 -0
- package/symbols/led_left.ts +4 -0
- package/symbols/led_right.ts +20 -0
- package/symbols/led_up.ts +4 -0
- package/symbols/led_horz.ts +0 -18
- package/symbols/led_vert.ts +0 -22
package/drawing/rotateSymbol.ts
CHANGED
@@ -40,13 +40,13 @@ const rotateAnchor = (
|
|
40
40
|
case "left":
|
41
41
|
switch (anchor) {
|
42
42
|
case "middle_top":
|
43
|
-
return "
|
43
|
+
return "middle_bottom"
|
44
44
|
case "middle_bottom":
|
45
|
-
return "
|
45
|
+
return "middle_top"
|
46
46
|
case "middle_left":
|
47
|
-
return "
|
47
|
+
return "middle_right"
|
48
48
|
case "middle_right":
|
49
|
-
return "
|
49
|
+
return "middle_left"
|
50
50
|
}
|
51
51
|
break
|
52
52
|
case "right":
|
package/package.json
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
import { defineSymbol } from "drawing/defineSymbol"
|
2
|
+
import svgJson from "assets/generated/led.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.bottom1, anchor: "middle_top" },
|
12
|
+
{ ...texts.right1, anchor: "middle_bottom" },
|
13
|
+
] as Primitive[],
|
14
|
+
ports: [
|
15
|
+
{ ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
|
16
|
+
{ ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
|
17
|
+
],
|
18
|
+
size: { width: bounds.width, height: bounds.height },
|
19
|
+
center: { x: bounds.centerX, y: bounds.centerY },
|
20
|
+
})
|
package/symbols/led_horz.ts
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
import svgJson from "assets/generated/led.json"
|
2
|
-
import { defineSymbol } from "drawing/defineSymbol"
|
3
|
-
|
4
|
-
const { paths, texts, bounds, refblocks } = svgJson
|
5
|
-
|
6
|
-
export default defineSymbol({
|
7
|
-
primitives: [
|
8
|
-
...Object.values(paths),
|
9
|
-
{ ...texts.bottom1, anchor: "middle_right" },
|
10
|
-
{ ...texts.right1, anchor: "middle_left" },
|
11
|
-
] as any,
|
12
|
-
ports: [
|
13
|
-
{ ...refblocks.left1, labels: ["1", "anode", "pos"] },
|
14
|
-
{ ...refblocks.right1, labels: ["2", "cathode", "neg"] },
|
15
|
-
],
|
16
|
-
size: { width: bounds.width, height: bounds.height },
|
17
|
-
center: { x: bounds.centerX, y: bounds.centerY + 0.1 },
|
18
|
-
})
|
package/symbols/led_vert.ts
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
import { rotateSymbol } from "drawing/rotateSymbol"
|
2
|
-
import led_horz from "./led_horz"
|
3
|
-
import type { TextPrimitive } from "drawing"
|
4
|
-
|
5
|
-
const rotated = rotateSymbol(led_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 += 0.1
|
18
|
-
ref.y += 0.017
|
19
|
-
val.y = ref.y
|
20
|
-
val.x = -0.3
|
21
|
-
|
22
|
-
export default rotated
|