@supermousejs/core 2.0.4 → 2.1.0
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/CHANGELOG.md +51 -31
- package/LICENSE.md +21 -21
- package/README.md +30 -31
- package/dist/index.d.ts +8 -55
- package/dist/index.mjs +85 -146
- package/dist/index.umd.js +2 -2
- package/package.json +11 -1
- package/src/Supermouse.ts +339 -405
- package/src/index.ts +2 -2
- package/src/systems/Input.ts +231 -262
- package/src/systems/Stage.ts +126 -156
- package/src/systems/index.ts +2 -2
- package/src/types.ts +168 -169
- package/src/utils/math.ts +11 -20
- package/tsconfig.json +7 -14
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.ts +32 -32
package/src/utils/math.ts
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return lerp(a, b, 1 - Math.exp(-lambda * dt));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Calculates the angle in degrees between two points.
|
|
17
|
-
*/
|
|
18
|
-
export function angle(x: number, y: number): number {
|
|
19
|
-
return Math.atan2(y, x) * (180 / Math.PI);
|
|
20
|
-
}
|
|
1
|
+
export function lerp(start: number, end: number, factor: number): number {
|
|
2
|
+
return start + (end - start) * factor;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function damp(a: number, b: number, lambda: number, dt: number): number {
|
|
6
|
+
return lerp(a, b, 1 - Math.exp(-lambda * dt));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function angle(x: number, y: number): number {
|
|
10
|
+
return Math.atan2(y, x) * (180 / Math.PI);
|
|
11
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../tsconfig.
|
|
3
|
-
"include": [
|
|
4
|
-
"src"
|
|
5
|
-
],
|
|
2
|
+
"extends": "../../tsconfig.composite-lib.json",
|
|
6
3
|
"compilerOptions": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"noImplicitReturns": true,
|
|
14
|
-
"paths": {}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
4
|
+
"rootDir": "src",
|
|
5
|
+
"outDir": "dist"
|
|
6
|
+
},
|
|
7
|
+
"include": ["src"],
|
|
8
|
+
"references": []
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":[],"fileInfos":[],"root":[],"options":{"allowImportingTsExtensions":true,"composite":true,"declaration":true,"declarationMap":true,"esModuleInterop":true,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"../../dist","rootDir":"../../src","skipLibCheck":true,"strict":true,"target":7,"useDefineForClassFields":true},"version":"5.8.3"}
|
package/vite.config.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { defineConfig } from
|
|
2
|
-
import dts from
|
|
3
|
-
import path from
|
|
4
|
-
import { fileURLToPath } from
|
|
5
|
-
import { readFileSync } from
|
|
6
|
-
|
|
7
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
-
const __dirname = path.dirname(__filename);
|
|
9
|
-
|
|
10
|
-
const pkg = JSON.parse(readFileSync(path.resolve(__dirname,
|
|
11
|
-
|
|
12
|
-
export default defineConfig({
|
|
13
|
-
define: {
|
|
14
|
-
__VERSION__: JSON.stringify(pkg.version)
|
|
15
|
-
},
|
|
16
|
-
build: {
|
|
17
|
-
lib: {
|
|
18
|
-
entry: path.resolve(__dirname,
|
|
19
|
-
name:
|
|
20
|
-
fileName: (format) => format ===
|
|
21
|
-
},
|
|
22
|
-
rollupOptions: {
|
|
23
|
-
external: [],
|
|
24
|
-
output: {
|
|
25
|
-
globals: {
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
plugins: [dts({ rollupTypes: true })]
|
|
32
|
-
});
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import dts from "vite-plugin-dts";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import { readFileSync } from "fs";
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
|
|
10
|
+
const pkg = JSON.parse(readFileSync(path.resolve(__dirname, "package.json"), "utf-8"));
|
|
11
|
+
|
|
12
|
+
export default defineConfig({
|
|
13
|
+
define: {
|
|
14
|
+
__VERSION__: JSON.stringify(pkg.version)
|
|
15
|
+
},
|
|
16
|
+
build: {
|
|
17
|
+
lib: {
|
|
18
|
+
entry: path.resolve(__dirname, "src/index.ts"),
|
|
19
|
+
name: "SupermouseCore",
|
|
20
|
+
fileName: (format) => (format === "es" ? "index.mjs" : "index.umd.js")
|
|
21
|
+
},
|
|
22
|
+
rollupOptions: {
|
|
23
|
+
external: [],
|
|
24
|
+
output: {
|
|
25
|
+
globals: {
|
|
26
|
+
"@supermousejs/core": "SupermouseCore"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
plugins: [dts({ rollupTypes: true })]
|
|
32
|
+
});
|