@hprint/shared 0.0.1-alpha.3 → 0.0.1-alpha.4

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@hprint/shared",
3
- "version": "0.0.1-alpha.3",
3
+ "version": "0.0.1-alpha.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
- import LengthConvert from './lengthConvert';
2
- import mathHelper from './mathHelper';
3
- import utils from './utils';
4
- import { fabric } from 'fabric';
5
-
6
- export { LengthConvert, mathHelper, utils, fabric };
1
+ import LengthConvert from './lengthConvert';
2
+ import mathHelper from './mathHelper';
3
+ import utils from './utils';
4
+ import { fabric } from 'fabric';
5
+
6
+ export { LengthConvert, mathHelper, utils, fabric };
package/src/mathHelper.ts CHANGED
@@ -1,25 +1,25 @@
1
- /**
2
- * 获取多边形顶点坐标
3
- * @param edges 变数
4
- * @param radius 半径
5
- * @returns 坐标数组
6
- */
7
- const getPolygonVertices = (edges: number, radius: number) => {
8
- const vertices = [];
9
- const interiorAngle = (Math.PI * 2) / edges;
10
- let rotationAdjustment = -Math.PI / 2;
11
- if (edges % 2 === 0) {
12
- rotationAdjustment += interiorAngle / 2;
13
- }
14
- for (let i = 0; i < edges; i++) {
15
- // 画圆取顶点坐标
16
- const rad = i * interiorAngle + rotationAdjustment;
17
- vertices.push({
18
- x: Math.cos(rad) * radius,
19
- y: Math.sin(rad) * radius,
20
- });
21
- }
22
- return vertices;
23
- };
24
-
25
- export default { getPolygonVertices };
1
+ /**
2
+ * 获取多边形顶点坐标
3
+ * @param edges 变数
4
+ * @param radius 半径
5
+ * @returns 坐标数组
6
+ */
7
+ const getPolygonVertices = (edges: number, radius: number) => {
8
+ const vertices = [];
9
+ const interiorAngle = (Math.PI * 2) / edges;
10
+ let rotationAdjustment = -Math.PI / 2;
11
+ if (edges % 2 === 0) {
12
+ rotationAdjustment += interiorAngle / 2;
13
+ }
14
+ for (let i = 0; i < edges; i++) {
15
+ // 画圆取顶点坐标
16
+ const rad = i * interiorAngle + rotationAdjustment;
17
+ vertices.push({
18
+ x: Math.cos(rad) * radius,
19
+ y: Math.sin(rad) * radius,
20
+ });
21
+ }
22
+ return vertices;
23
+ };
24
+
25
+ export default { getPolygonVertices };
package/tsconfig.json CHANGED
@@ -1,10 +1,10 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./",
6
- "composite": true
7
- },
8
- "include": ["**/*.ts"],
9
- "exclude": ["node_modules", "dist"]
10
- }
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./",
6
+ "composite": true
7
+ },
8
+ "include": ["**/*.ts"],
9
+ "exclude": ["node_modules", "dist"]
10
+ }
package/vite.config.ts CHANGED
@@ -1,29 +1,29 @@
1
- import { defineConfig } from 'vite';
2
- import { resolve } from 'path';
3
- import { fileURLToPath } from 'url';
4
- import dts from 'vite-plugin-dts';
5
-
6
- const __dirname = fileURLToPath(new URL('.', import.meta.url));
7
-
8
- export default defineConfig({
9
- plugins: [
10
- dts({
11
- outDir: 'dist',
12
- include: ['src/**/*'],
13
- }),
14
- ],
15
- build: {
16
- lib: {
17
- entry: resolve(__dirname, 'src/index.ts'),
18
- name: '@hprint/shared',
19
- fileName: 'index',
20
- formats: ['es', 'cjs'],
21
- },
22
- rollupOptions: {
23
- external: [],
24
- output: {
25
- globals: {},
26
- },
27
- },
28
- },
29
- });
1
+ import { defineConfig } from 'vite';
2
+ import { resolve } from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import dts from 'vite-plugin-dts';
5
+
6
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
7
+
8
+ export default defineConfig({
9
+ plugins: [
10
+ dts({
11
+ outDir: 'dist',
12
+ include: ['src/**/*'],
13
+ }),
14
+ ],
15
+ build: {
16
+ lib: {
17
+ entry: resolve(__dirname, 'src/index.ts'),
18
+ name: '@hprint/shared',
19
+ fileName: 'index',
20
+ formats: ['es', 'cjs'],
21
+ },
22
+ rollupOptions: {
23
+ external: [],
24
+ output: {
25
+ globals: {},
26
+ },
27
+ },
28
+ },
29
+ });