@retikz/core 0.0.1-rc.2 → 0.0.1-rc.3
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.
|
@@ -49,7 +49,8 @@ const useConvertWay = (way) => {
|
|
|
49
49
|
case "coordinate": {
|
|
50
50
|
const corPosition = formatPointPosition(item);
|
|
51
51
|
cursor = corPosition;
|
|
52
|
-
|
|
52
|
+
acc.push(corPosition);
|
|
53
|
+
return acc;
|
|
53
54
|
}
|
|
54
55
|
case "node": {
|
|
55
56
|
if (![0, way.length - 1].includes(index)) {
|
|
@@ -65,7 +66,8 @@ const useConvertWay = (way) => {
|
|
|
65
66
|
});
|
|
66
67
|
if (cb) subscribeCbs.push(cb);
|
|
67
68
|
cursor = nodeModel.center;
|
|
68
|
-
|
|
69
|
+
acc.push(nodeModel);
|
|
70
|
+
return acc;
|
|
69
71
|
}
|
|
70
72
|
case "vertical": {
|
|
71
73
|
if ([0, way.length - 1].includes(index)) {
|
|
@@ -82,17 +84,22 @@ const useConvertWay = (way) => {
|
|
|
82
84
|
if (Array.isArray(verPosition[0])) {
|
|
83
85
|
const realVerPosition = verPosition;
|
|
84
86
|
cursor = realVerPosition[realVerPosition.length - 1];
|
|
85
|
-
|
|
87
|
+
for (const point of realVerPosition) {
|
|
88
|
+
acc.push(point);
|
|
89
|
+
}
|
|
90
|
+
return acc;
|
|
86
91
|
}
|
|
87
92
|
cursor = verPosition;
|
|
88
|
-
|
|
93
|
+
acc.push(verPosition);
|
|
94
|
+
return acc;
|
|
89
95
|
}
|
|
90
96
|
default: {
|
|
91
97
|
if (index === 0) throw new Error("offset/move point can not be the first point on path.");
|
|
92
98
|
const convertedPos = convertOffsetAndMovePoint(item);
|
|
93
99
|
const curPos = DescartesPoint.plus(convertedPos, cursor);
|
|
94
100
|
if (type === "move") cursor = curPos;
|
|
95
|
-
|
|
101
|
+
acc.push(curPos);
|
|
102
|
+
return acc;
|
|
96
103
|
}
|
|
97
104
|
}
|
|
98
105
|
}, []),
|
package/dist/es/test.d.ts
CHANGED
|
@@ -51,7 +51,8 @@ const useConvertWay = (way) => {
|
|
|
51
51
|
case "coordinate": {
|
|
52
52
|
const corPosition = formatPointPosition(item);
|
|
53
53
|
cursor = corPosition;
|
|
54
|
-
|
|
54
|
+
acc.push(corPosition);
|
|
55
|
+
return acc;
|
|
55
56
|
}
|
|
56
57
|
case "node": {
|
|
57
58
|
if (![0, way.length - 1].includes(index)) {
|
|
@@ -67,7 +68,8 @@ const useConvertWay = (way) => {
|
|
|
67
68
|
});
|
|
68
69
|
if (cb) subscribeCbs.push(cb);
|
|
69
70
|
cursor = nodeModel.center;
|
|
70
|
-
|
|
71
|
+
acc.push(nodeModel);
|
|
72
|
+
return acc;
|
|
71
73
|
}
|
|
72
74
|
case "vertical": {
|
|
73
75
|
if ([0, way.length - 1].includes(index)) {
|
|
@@ -84,17 +86,22 @@ const useConvertWay = (way) => {
|
|
|
84
86
|
if (Array.isArray(verPosition[0])) {
|
|
85
87
|
const realVerPosition = verPosition;
|
|
86
88
|
cursor = realVerPosition[realVerPosition.length - 1];
|
|
87
|
-
|
|
89
|
+
for (const point of realVerPosition) {
|
|
90
|
+
acc.push(point);
|
|
91
|
+
}
|
|
92
|
+
return acc;
|
|
88
93
|
}
|
|
89
94
|
cursor = verPosition;
|
|
90
|
-
|
|
95
|
+
acc.push(verPosition);
|
|
96
|
+
return acc;
|
|
91
97
|
}
|
|
92
98
|
default: {
|
|
93
99
|
if (index === 0) throw new Error("offset/move point can not be the first point on path.");
|
|
94
100
|
const convertedPos = convertOffsetAndMovePoint(item);
|
|
95
101
|
const curPos = DescartesPoint.default.plus(convertedPos, cursor);
|
|
96
102
|
if (type === "move") cursor = curPos;
|
|
97
|
-
|
|
103
|
+
acc.push(curPos);
|
|
104
|
+
return acc;
|
|
98
105
|
}
|
|
99
106
|
}
|
|
100
107
|
}, []),
|
package/dist/lib/test.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retikz/core",
|
|
3
|
-
"version": "0.0.1-rc.
|
|
3
|
+
"version": "0.0.1-rc.3",
|
|
4
4
|
"description": "atomic drawing library implemented using react and d3, inspired by tikz",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://pionpill.github.io/retikz.doc/",
|
|
@@ -22,6 +22,12 @@
|
|
|
22
22
|
"README.md",
|
|
23
23
|
"dist/**/*"
|
|
24
24
|
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"dev": "vite",
|
|
27
|
+
"build": "vite build",
|
|
28
|
+
"lint": "eslint .",
|
|
29
|
+
"preview": "vite preview"
|
|
30
|
+
},
|
|
25
31
|
"peerDependencies": {
|
|
26
32
|
"react": ">=18",
|
|
27
33
|
"react-dom": ">=18"
|
|
@@ -48,11 +54,5 @@
|
|
|
48
54
|
"typescript-eslint": "^8.15.0",
|
|
49
55
|
"vite": "^6.0.1",
|
|
50
56
|
"vite-plugin-dts": "^4.5.0"
|
|
51
|
-
},
|
|
52
|
-
"scripts": {
|
|
53
|
-
"dev": "vite",
|
|
54
|
-
"build": "vite build",
|
|
55
|
-
"lint": "eslint .",
|
|
56
|
-
"preview": "vite preview"
|
|
57
57
|
}
|
|
58
|
-
}
|
|
58
|
+
}
|