@umicat/three-sdk 0.8.3 → 0.8.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/dist/Input3D.d.ts +12 -0
- package/dist/Input3D.js +4 -2
- package/package.json +1 -1
package/dist/Input3D.d.ts
CHANGED
|
@@ -55,6 +55,17 @@ export interface Input3DOptions {
|
|
|
55
55
|
/** Radians of camera rotation per screen-width dragged. Same number governs
|
|
56
56
|
* touch drags and desktop right-drags, so there is one knob to turn. */
|
|
57
57
|
lookSensitivity?: number;
|
|
58
|
+
/**
|
|
59
|
+
* How much of the top of the screen the move and look zones leave alone.
|
|
60
|
+
*
|
|
61
|
+
* A HUD lives at the top — score, hearts, a mute button — and the zones are
|
|
62
|
+
* full-screen and sit ABOVE the game's DOM, so without this every button up
|
|
63
|
+
* there is unreachable on a phone while looking perfectly fine. Nobody
|
|
64
|
+
* drives a thumbstick from the top edge, so the trade is free.
|
|
65
|
+
*
|
|
66
|
+
* A CSS length; the default is `max(64px, 12%)`.
|
|
67
|
+
*/
|
|
68
|
+
controlsTopInset?: string;
|
|
58
69
|
}
|
|
59
70
|
/**
|
|
60
71
|
* Movement and jump, from a keyboard or a thumb, behind one interface.
|
|
@@ -82,6 +93,7 @@ export declare class Input3D {
|
|
|
82
93
|
private actions;
|
|
83
94
|
private stickMode;
|
|
84
95
|
private wantLook;
|
|
96
|
+
private topInset;
|
|
85
97
|
private lookSens;
|
|
86
98
|
private readonly lookDelta;
|
|
87
99
|
private enabled;
|
package/dist/Input3D.js
CHANGED
|
@@ -69,6 +69,7 @@ export class Input3D {
|
|
|
69
69
|
this.actions = [];
|
|
70
70
|
this.stickMode = 'floating';
|
|
71
71
|
this.wantLook = true;
|
|
72
|
+
this.topInset = 'max(64px, 12%)';
|
|
72
73
|
this.lookSens = 4.6;
|
|
73
74
|
this.lookDelta = { x: 0, y: 0 };
|
|
74
75
|
this.enabled = true;
|
|
@@ -88,6 +89,7 @@ export class Input3D {
|
|
|
88
89
|
this.actions = opts.actions ?? [];
|
|
89
90
|
this.stickMode = opts.stick ?? 'floating';
|
|
90
91
|
this.wantLook = opts.look ?? true;
|
|
92
|
+
this.topInset = opts.controlsTopInset ?? 'max(64px, 12%)';
|
|
91
93
|
this.lookSens = opts.lookSensitivity ?? 4.6;
|
|
92
94
|
if (this.wantLook && typeof document !== 'undefined') {
|
|
93
95
|
this.mountMouseLook(opts.container?.ownerDocument ?? document);
|
|
@@ -314,7 +316,7 @@ export class Input3D {
|
|
|
314
316
|
// anything. It deliberately stops short of the buttons on the right.
|
|
315
317
|
const zone = document.createElement('div');
|
|
316
318
|
Object.assign(zone.style, {
|
|
317
|
-
position: 'absolute', left: '0', top:
|
|
319
|
+
position: 'absolute', left: '0', top: this.topInset, width: '50%', bottom: '0',
|
|
318
320
|
pointerEvents: floating ? 'auto' : 'none',
|
|
319
321
|
});
|
|
320
322
|
Object.assign(zone.style, NO_SELECTION);
|
|
@@ -323,7 +325,7 @@ export class Input3D {
|
|
|
323
325
|
// can be the whole right half rather than an awkward cut-out around them.
|
|
324
326
|
const lookZone = document.createElement('div');
|
|
325
327
|
Object.assign(lookZone.style, {
|
|
326
|
-
position: 'absolute', right: '0', top:
|
|
328
|
+
position: 'absolute', right: '0', top: this.topInset, width: '50%', bottom: '0',
|
|
327
329
|
pointerEvents: this.wantLook ? 'auto' : 'none',
|
|
328
330
|
});
|
|
329
331
|
Object.assign(lookZone.style, NO_SELECTION);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umicat/three-sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "Three.js runtime for Umicat games: the scene3d design format, its loader with physics, a kinematic character controller, and the Umicat platform via @umicat/platform-sdk.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|