three-gamepad-controls 0.10.1 → 0.10.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.
|
@@ -50,12 +50,12 @@ type GamepadOrbitControlsOptions = {
|
|
|
50
50
|
axisPanY: number;
|
|
51
51
|
/**
|
|
52
52
|
* Button index for zooming **in** (analog trigger value used for proportional zoom).
|
|
53
|
-
* @default
|
|
53
|
+
* @default 7 — Right trigger
|
|
54
54
|
*/
|
|
55
55
|
buttonDollyIn: number;
|
|
56
56
|
/**
|
|
57
57
|
* Button index for zooming **out** (analog trigger value used for proportional zoom).
|
|
58
|
-
* @default
|
|
58
|
+
* @default 6 — Left trigger
|
|
59
59
|
*/
|
|
60
60
|
buttonDollyOut: number;
|
|
61
61
|
};
|
|
@@ -13,8 +13,8 @@ const DEFAULT_ORBIT_OPTIONS = {
|
|
|
13
13
|
axisRotateY: GAMEPAD_AXIS.LeftY,
|
|
14
14
|
axisPanX: GAMEPAD_AXIS.RightX,
|
|
15
15
|
axisPanY: GAMEPAD_AXIS.RightY,
|
|
16
|
-
buttonDollyIn: GAMEPAD_BUTTON.
|
|
17
|
-
buttonDollyOut: GAMEPAD_BUTTON.
|
|
16
|
+
buttonDollyIn: GAMEPAD_BUTTON.RightTrigger,
|
|
17
|
+
buttonDollyOut: GAMEPAD_BUTTON.LeftTrigger
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* Adds gamepad support to Three.js `OrbitControls`.
|
|
@@ -55,8 +55,8 @@ var GamepadOrbitControls = class extends GamepadControls {
|
|
|
55
55
|
if (panX !== 0 || panY !== 0) this.#controls.pan(panX * panSpeed * deltaTime * 500, panY * panSpeed * deltaTime * 500);
|
|
56
56
|
const triggerIn = gamepad.buttons[buttonDollyIn]?.value ?? 0;
|
|
57
57
|
const triggerOut = gamepad.buttons[buttonDollyOut]?.value ?? 0;
|
|
58
|
-
if (triggerIn > deadzone) this.#controls.dollyIn(1 + zoomSpeed * triggerIn * deltaTime);
|
|
59
|
-
if (triggerOut > deadzone) this.#controls.dollyOut(1 + zoomSpeed * triggerOut * deltaTime);
|
|
58
|
+
if (triggerIn > deadzone) this.#controls.dollyIn(1 / (1 + zoomSpeed * triggerIn * deltaTime));
|
|
59
|
+
if (triggerOut > deadzone) this.#controls.dollyOut(1 / (1 + zoomSpeed * triggerOut * deltaTime));
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Returns `value` unchanged, or `0` if below the dead zone `threshold`.
|
package/package.json
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "three-gamepad-controls",
|
|
3
3
|
"description": "Gamepad support for Three.js controls.",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
4
|
+
"version": "0.10.3",
|
|
5
|
+
"homepage": "https://github.com/luckasnix/three-gamepad-controls#readme",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Kasnix",
|
|
8
|
+
"url": "https://github.com/luckasnix"
|
|
9
|
+
},
|
|
6
10
|
"repository": {
|
|
7
11
|
"type": "git",
|
|
8
12
|
"url": "git+https://github.com/luckasnix/three-gamepad-controls.git"
|
|
9
13
|
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/luckasnix/three-gamepad-controls/issues"
|
|
16
|
+
},
|
|
10
17
|
"type": "module",
|
|
11
18
|
"sideEffects": false,
|
|
12
19
|
"types": "./dist/index.d.ts",
|
|
@@ -31,8 +38,12 @@
|
|
|
31
38
|
"publishConfig": {
|
|
32
39
|
"access": "public"
|
|
33
40
|
},
|
|
34
|
-
"
|
|
35
|
-
"
|
|
41
|
+
"devEngines": {
|
|
42
|
+
"runtime": {
|
|
43
|
+
"name": "node",
|
|
44
|
+
"version": ">=24.0.0",
|
|
45
|
+
"onFail": "error"
|
|
46
|
+
}
|
|
36
47
|
},
|
|
37
48
|
"devDependencies": {
|
|
38
49
|
"@biomejs/biome": "2.4.16",
|
|
@@ -43,7 +54,7 @@
|
|
|
43
54
|
"@types/three": "0.184.1",
|
|
44
55
|
"husky": "9.1.7",
|
|
45
56
|
"three": "0.184.0",
|
|
46
|
-
"tsdown": "0.22.
|
|
57
|
+
"tsdown": "0.22.2",
|
|
47
58
|
"typescript": "6.0.3"
|
|
48
59
|
},
|
|
49
60
|
"peerDependencies": {
|