@vived/app 4.11.3 → 4.13.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/lib/Components/HoverLabel/Controllers/StylusHoverLabel.d.ts +2 -2
- package/lib/Components/HoverLabel/Controllers/StylusHoverLabel.js +3 -3
- package/lib/Components/RequestHandler/UC/StartZSpaceUC.js +12 -1
- package/lib/Components/RequestHandler/UC/StopZSpaceUC.js +20 -7
- package/lib/Components/SceneRoot/Controllers/ScaleSceneRootSC.d.ts +14 -0
- package/lib/Components/SceneRoot/Controllers/ScaleSceneRootSC.js +55 -0
- package/lib/Components/SceneRoot/Controllers/SceneRootMoveSC.d.ts +14 -0
- package/lib/Components/SceneRoot/Controllers/SceneRootMoveSC.js +53 -0
- package/lib/Components/SceneRoot/Controllers/index.d.ts +2 -2
- package/lib/Components/SceneRoot/Controllers/index.js +2 -2
- package/lib/Components/Selection/Controller/HoverOnAppObjectSC.d.ts +11 -0
- package/lib/Components/Selection/Controller/HoverOnAppObjectSC.js +41 -0
- package/lib/Components/Selection/Controller/PressOnAppObjectSC.d.ts +18 -0
- package/lib/Components/Selection/Controller/PressOnAppObjectSC.js +70 -0
- package/lib/Components/Selection/Controller/SelectAppObjectSC.d.ts +11 -0
- package/lib/Components/Selection/Controller/SelectAppObjectSC.js +39 -0
- package/lib/Components/Selection/Controller/index.d.ts +3 -3
- package/lib/Components/Selection/Controller/index.js +3 -3
- package/lib/Components/Stylus/Entity/StylusEntity.d.ts +21 -0
- package/lib/Components/Stylus/Entity/StylusEntity.js +104 -0
- package/lib/Components/Stylus/Entity/index.d.ts +1 -0
- package/lib/Components/Stylus/Entity/index.js +13 -0
- package/lib/Components/Stylus/Mocks/MockEmulateStylusUC.d.ts +10 -0
- package/lib/Components/Stylus/Mocks/MockEmulateStylusUC.js +19 -0
- package/lib/Components/Stylus/Mocks/index.d.ts +1 -0
- package/lib/Components/Stylus/Mocks/index.js +13 -0
- package/lib/Components/Stylus/PMs/StylusColorLengthPM.d.ts +14 -0
- package/lib/Components/Stylus/PMs/StylusColorLengthPM.js +81 -0
- package/lib/Components/Stylus/PMs/StylusIsInUsePM.d.ts +6 -0
- package/lib/Components/Stylus/PMs/StylusIsInUsePM.js +36 -0
- package/lib/Components/Stylus/PMs/index.d.ts +2 -0
- package/lib/Components/Stylus/PMs/index.js +14 -0
- package/lib/Components/Stylus/UCs/EmulateStylusUC.d.ts +9 -0
- package/lib/Components/Stylus/UCs/EmulateStylusUC.js +132 -0
- package/lib/Components/Stylus/UCs/index.d.ts +1 -0
- package/lib/Components/Stylus/UCs/index.js +13 -0
- package/lib/Components/Stylus/index.d.ts +4 -0
- package/lib/Components/Stylus/index.js +16 -0
- package/lib/Components/Transform3D/UC/StylusMoveTransformUC.js +14 -35
- package/lib/Components/index.d.ts +5 -4
- package/lib/Components/index.js +5 -4
- package/lib/Components/zSpace/Controllers/EmulateStylus.d.ts +2 -1
- package/lib/Components/zSpace/Controllers/EmulateStylus.js +13 -0
- package/lib/Components/zSpace/Entities/ZSpaceEntity.d.ts +0 -2
- package/lib/Components/zSpace/Entities/ZSpaceEntity.js +0 -3
- package/lib/Components/zSpace/Entities/index.d.ts +0 -1
- package/lib/Components/zSpace/Entities/index.js +0 -1
- package/lib/Components/zSpace/PM/index.d.ts +0 -2
- package/lib/Components/zSpace/PM/index.js +0 -2
- package/lib/Components/zSpace/UC/StylusFromGamepadHook.d.ts +2 -3
- package/lib/Components/zSpace/UC/StylusFromGamepadHook.js +14 -13
- package/lib/Components/zSpace/index.d.ts +0 -1
- package/lib/Components/zSpace/index.js +0 -1
- package/lib/Entities/TransformNode.d.ts +0 -55
- package/lib/ValueObjects/Color.js +1 -1
- package/lib/ValueObjects/ParametricLine.d.ts +3 -0
- package/lib/ValueObjects/ParametricLine.js +13 -3
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeStylusFromGamepadHook = exports.StylusFromGamepadHook = void 0;
|
|
4
|
-
const
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
5
|
const ValueObjects_1 = require("../../../ValueObjects");
|
|
6
|
+
const Stylus_1 = require("../../Stylus");
|
|
6
7
|
const XR_1 = require("../../XR");
|
|
7
|
-
|
|
8
|
-
class StylusFromGamepadHook extends AppObjectUC_1.AppObjectUC {
|
|
8
|
+
class StylusFromGamepadHook extends AppObject_1.AppObjectUC {
|
|
9
9
|
}
|
|
10
10
|
exports.StylusFromGamepadHook = StylusFromGamepadHook;
|
|
11
11
|
StylusFromGamepadHook.type = "StylusFromGamepadHook";
|
|
@@ -18,7 +18,7 @@ class StylusFromGamepadUCImp extends StylusFromGamepadHook {
|
|
|
18
18
|
super(appObject, StylusFromGamepadHook.type);
|
|
19
19
|
this.lastPresses = [false, false, false];
|
|
20
20
|
this.onNewXRFrame = () => {
|
|
21
|
-
if (!this.xrEntity)
|
|
21
|
+
if (!this.xrEntity || !this.stylus)
|
|
22
22
|
return;
|
|
23
23
|
const frame = this.xrEntity.lastXRFrame;
|
|
24
24
|
if (!frame)
|
|
@@ -43,23 +43,23 @@ class StylusFromGamepadUCImp extends StylusFromGamepadHook {
|
|
|
43
43
|
if (stylusPose)
|
|
44
44
|
this.processStylusPose(stylusPose);
|
|
45
45
|
};
|
|
46
|
-
const
|
|
47
|
-
if (!zSpaceEntity) {
|
|
48
|
-
throw new Error("No ZSpace Entity");
|
|
49
|
-
}
|
|
50
|
-
this.zSpace = zSpaceEntity;
|
|
51
|
-
const xrEntity = zSpaceEntity.appObject.getComponent(XR_1.XREntity.type);
|
|
46
|
+
const xrEntity = appObject.getComponent(XR_1.XREntity.type);
|
|
52
47
|
if (!xrEntity) {
|
|
53
|
-
this.
|
|
48
|
+
this.error("Added to an App Object that does not have XREntity");
|
|
54
49
|
return;
|
|
55
50
|
}
|
|
56
51
|
this.xrEntity = xrEntity;
|
|
57
52
|
this.xrEntity.addChangeObserver(this.onNewXRFrame);
|
|
58
53
|
}
|
|
54
|
+
get stylus() {
|
|
55
|
+
return this.getCachedSingleton(Stylus_1.StylusEntity.type);
|
|
56
|
+
}
|
|
59
57
|
processStylusPose(pose) {
|
|
60
58
|
const matrix = ValueObjects_1.Matrix.FromFloat32Array(pose.transform.matrix);
|
|
61
59
|
const flippedMatrix = ValueObjects_1.Matrix.FlipTransformMatrixHand(matrix);
|
|
62
|
-
this.
|
|
60
|
+
if (this.stylus) {
|
|
61
|
+
this.stylus.transform.localMatrix = flippedMatrix;
|
|
62
|
+
}
|
|
63
63
|
}
|
|
64
64
|
processButtons(stylusSource) {
|
|
65
65
|
var _a, _b, _c;
|
|
@@ -73,9 +73,10 @@ class StylusFromGamepadUCImp extends StylusFromGamepadHook {
|
|
|
73
73
|
presses[1] = (_b = gamepad.buttons[3]) === null || _b === void 0 ? void 0 : _b.pressed;
|
|
74
74
|
presses[2] = (_c = gamepad.buttons[4]) === null || _c === void 0 ? void 0 : _c.pressed;
|
|
75
75
|
presses.forEach((press, i) => {
|
|
76
|
+
var _a;
|
|
76
77
|
if (this.lastPresses[i] !== press) {
|
|
77
78
|
this.lastPresses[i] = press;
|
|
78
|
-
this.
|
|
79
|
+
(_a = this.stylus) === null || _a === void 0 ? void 0 : _a.updateButtonState(i, press);
|
|
79
80
|
}
|
|
80
81
|
});
|
|
81
82
|
}
|
|
@@ -2,75 +2,20 @@ import { EaseFn } from "../Types";
|
|
|
2
2
|
import { Matrix, Quaternion, Vector3 } from "../ValueObjects";
|
|
3
3
|
export declare type OnTransformNodeChange = () => void;
|
|
4
4
|
export interface TransformNode {
|
|
5
|
-
/**
|
|
6
|
-
* Local position of the transform
|
|
7
|
-
*/
|
|
8
5
|
localPosition: Vector3;
|
|
9
|
-
/**
|
|
10
|
-
* The world position of the transform
|
|
11
|
-
*/
|
|
12
6
|
worldPosition: Vector3;
|
|
13
|
-
/**
|
|
14
|
-
* Local roation of the transform
|
|
15
|
-
*/
|
|
16
7
|
localRotation: Quaternion;
|
|
17
|
-
/**
|
|
18
|
-
* World roation of the transform
|
|
19
|
-
*/
|
|
20
8
|
worldRotation: Quaternion;
|
|
21
|
-
/**
|
|
22
|
-
* Local scale of the transform
|
|
23
|
-
*/
|
|
24
9
|
localScale: Vector3;
|
|
25
|
-
/**
|
|
26
|
-
* World scale of the transform
|
|
27
|
-
*/
|
|
28
10
|
worldScale: Vector3;
|
|
29
|
-
/**
|
|
30
|
-
* Local transformation matrix
|
|
31
|
-
*/
|
|
32
11
|
localMatrix: Matrix;
|
|
33
|
-
/**
|
|
34
|
-
* The global transformation matrix
|
|
35
|
-
*/
|
|
36
12
|
worldMatrix: Matrix;
|
|
37
|
-
/**
|
|
38
|
-
* The transform's parent. Optional
|
|
39
|
-
*/
|
|
40
13
|
parent?: TransformNode;
|
|
41
|
-
/**
|
|
42
|
-
* Transforms a point from local to world space coordinates
|
|
43
|
-
* @param point point to transform in local coordinates
|
|
44
|
-
*/
|
|
45
14
|
localPointToWorld: (point: Vector3) => Vector3;
|
|
46
|
-
/**
|
|
47
|
-
* Transforms a point from world to local space coordinates
|
|
48
|
-
* @param point point to transform in world coordinates
|
|
49
|
-
*/
|
|
50
15
|
worldPointToLocal: (point: Vector3) => Vector3;
|
|
51
|
-
/**
|
|
52
|
-
* Transforms a local direction vector to world coordinates.
|
|
53
|
-
* @param direction direction to transform in local coordinates
|
|
54
|
-
*/
|
|
55
16
|
localDirectionToWorld: (direction: Vector3) => Vector3;
|
|
56
|
-
/**
|
|
57
|
-
* Transforms a world direction vector to local coordinates
|
|
58
|
-
* @param direction direction to transform in world coordinates
|
|
59
|
-
*/
|
|
60
17
|
worldDirectionToLocal: (direction: Vector3) => Vector3;
|
|
61
|
-
/**
|
|
62
|
-
* Lerps this transform node
|
|
63
|
-
* @param duration Lerp duration in MS
|
|
64
|
-
* @param ease Lerp ease function
|
|
65
|
-
* @param desiredPosition: Desired position. Optional.
|
|
66
|
-
* @param desiredRotation: Desired rotation. Optional.
|
|
67
|
-
* @param desiredScale: Desired scale. Optional.
|
|
68
|
-
* @param onCompletedCallback: Optional function to call when the lerp has completed
|
|
69
|
-
*/
|
|
70
18
|
lerp: (duration: number, ease: EaseFn, desiredPosition?: Vector3, desiredRotation?: Quaternion, desiredScale?: Vector3, onCompletedCallback?: () => void) => void;
|
|
71
|
-
/**
|
|
72
|
-
* Cancels any currently running lerp
|
|
73
|
-
*/
|
|
74
19
|
cancelLerp: () => void;
|
|
75
20
|
addObserver: (observer: OnTransformNodeChange) => void;
|
|
76
21
|
removeObserver: (observer: OnTransformNodeChange) => void;
|
|
@@ -17,11 +17,14 @@ export declare class ParametricLine {
|
|
|
17
17
|
static Left(): ParametricLine;
|
|
18
18
|
static Right(): ParametricLine;
|
|
19
19
|
static GetPointAtDistance(line: ParametricLine, distance: number): Vector3;
|
|
20
|
+
static GetDistanceToPoint(line: ParametricLine, point: Vector3): number;
|
|
20
21
|
readonly x0: number;
|
|
21
22
|
readonly y0: number;
|
|
22
23
|
readonly z0: number;
|
|
23
24
|
readonly a: number;
|
|
24
25
|
readonly b: number;
|
|
25
26
|
readonly c: number;
|
|
27
|
+
get origin(): Vector3;
|
|
28
|
+
get direction(): Vector3;
|
|
26
29
|
constructor(parameters: LineParameters);
|
|
27
30
|
}
|
|
@@ -7,9 +7,10 @@ class ParametricLine {
|
|
|
7
7
|
this.x0 = parameters.x0;
|
|
8
8
|
this.y0 = parameters.y0;
|
|
9
9
|
this.z0 = parameters.z0;
|
|
10
|
-
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
10
|
+
const dir = new Vector3_1.Vector3(parameters.a, parameters.b, parameters.c).unit;
|
|
11
|
+
this.a = dir.x;
|
|
12
|
+
this.b = dir.y;
|
|
13
|
+
this.c = dir.z;
|
|
13
14
|
}
|
|
14
15
|
// See https://planetcalc.com/8253/
|
|
15
16
|
static FromTwoPoint(p1, p2) {
|
|
@@ -62,5 +63,14 @@ class ParametricLine {
|
|
|
62
63
|
const z = line.z0 + line.c * distance;
|
|
63
64
|
return new Vector3_1.Vector3(x, y, z);
|
|
64
65
|
}
|
|
66
|
+
static GetDistanceToPoint(line, point) {
|
|
67
|
+
return Vector3_1.Vector3.Subtract(line.origin, point).magnitude;
|
|
68
|
+
}
|
|
69
|
+
get origin() {
|
|
70
|
+
return new Vector3_1.Vector3(this.x0, this.y0, this.z0);
|
|
71
|
+
}
|
|
72
|
+
get direction() {
|
|
73
|
+
return new Vector3_1.Vector3(this.a, this.b, this.c);
|
|
74
|
+
}
|
|
65
75
|
}
|
|
66
76
|
exports.ParametricLine = ParametricLine;
|