schematic-symbols 0.0.93 → 0.0.94

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.
@@ -7,12 +7,50 @@ import type {
7
7
  NinePointAnchor,
8
8
  } from "./types"
9
9
 
10
- const rotateAnchor = (anchor: NinePointAnchor): NinePointAnchor => {
11
- switch (anchor) {
12
- case "middle_top":
13
- return "middle_right"
14
- case "middle_bottom":
15
- return "middle_left"
10
+ // Update rotateAnchor to handle all anchor rotations based on orientation
11
+ const rotateAnchor = (
12
+ anchor: NinePointAnchor,
13
+ orientation: "up" | "down" | "left" | "right" = "right",
14
+ ): NinePointAnchor => {
15
+ switch (orientation) {
16
+ case "up":
17
+ switch (anchor) {
18
+ case "middle_top":
19
+ return "middle_left"
20
+ case "middle_bottom":
21
+ return "middle_right"
22
+ case "middle_left":
23
+ return "middle_bottom"
24
+ case "middle_right":
25
+ return "middle_top"
26
+ }
27
+ break
28
+ case "down":
29
+ switch (anchor) {
30
+ case "middle_top":
31
+ return "middle_right"
32
+ case "middle_bottom":
33
+ return "middle_left"
34
+ case "middle_left":
35
+ return "middle_top"
36
+ case "middle_right":
37
+ return "middle_bottom"
38
+ }
39
+ break
40
+ case "left":
41
+ switch (anchor) {
42
+ case "middle_top":
43
+ return "middle_left"
44
+ case "middle_bottom":
45
+ return "middle_right"
46
+ case "middle_left":
47
+ return "middle_bottom"
48
+ case "middle_right":
49
+ return "middle_top"
50
+ }
51
+ break
52
+ case "right":
53
+ return anchor // No change if orientation is "right"
16
54
  }
17
55
  return anchor
18
56
  }
@@ -54,7 +92,10 @@ export const rotateSymbol = (
54
92
  y: primitive.y,
55
93
  }) as Point
56
94
 
57
- primitive.anchor = rotateAnchor(primitive.anchor)
95
+ primitive.anchor = rotateAnchor(
96
+ primitive.anchor,
97
+ orientation ?? "right",
98
+ )
58
99
 
59
100
  return {
60
101
  ...primitive,
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.93",
4
+ "version": "0.0.94",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",