@vived/app 2.4.0 → 2.7.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/Core/BaseApp/Boundary.d.ts +8 -2
- package/lib/Core/BaseApp/Entity.d.ts +2 -0
- package/lib/Core/BaseApp/UseCase.d.ts +29 -19
- package/lib/Core/BaseApp/UseCase.js +211 -135
- package/lib/Entities/Babylon.d.ts +17 -0
- package/lib/Entities/Babylon.js +81 -0
- package/lib/Entities/BaseApp.d.ts +7 -0
- package/lib/Entities/BaseApp.js +27 -0
- package/lib/Entities/Color.d.ts +20 -0
- package/lib/Entities/Color.js +59 -0
- package/lib/Entities/DevicePreview.d.ts +11 -0
- package/lib/Entities/DevicePreview.js +44 -0
- package/lib/Entities/KeyboardInput.d.ts +14 -0
- package/lib/Entities/KeyboardInput.js +76 -0
- package/lib/Entities/LineSegment2D.d.ts +11 -0
- package/lib/Entities/LineSegment2D.js +70 -0
- package/lib/Entities/MemoizedBoolean.d.ts +7 -0
- package/lib/Entities/MemoizedBoolean.js +19 -0
- package/lib/Entities/MemoizedNumber.d.ts +7 -0
- package/lib/Entities/MemoizedNumber.js +19 -0
- package/lib/Entities/MemoizedString.d.ts +7 -0
- package/lib/Entities/MemoizedString.js +19 -0
- package/lib/Entities/MemoizedVector2.d.ts +12 -0
- package/lib/Entities/MemoizedVector2.js +37 -0
- package/lib/Entities/MemoizedVector3.d.ts +14 -0
- package/lib/Entities/MemoizedVector3.js +46 -0
- package/lib/Entities/ObserverList.d.ts +6 -0
- package/lib/Entities/ObserverList.js +23 -0
- package/lib/Entities/OrbitCamera.d.ts +17 -0
- package/lib/Entities/OrbitCamera.js +74 -0
- package/lib/Entities/ParametricLine.d.ts +29 -0
- package/lib/Entities/ParametricLine.js +79 -0
- package/lib/Entities/ParametricPlane.d.ts +20 -0
- package/lib/Entities/ParametricPlane.js +63 -0
- package/lib/Entities/StateMachine.d.ts +25 -0
- package/lib/Entities/StateMachine.js +81 -0
- package/lib/Entities/UndoRedo.d.ts +22 -0
- package/lib/Entities/UndoRedo.js +61 -0
- package/lib/Entities/Vector2.d.ts +21 -0
- package/lib/Entities/Vector2.js +83 -0
- package/lib/Entities/Vector3.d.ts +19 -0
- package/lib/Entities/Vector3.js +75 -0
- package/lib/Entities/index.d.ts +19 -0
- package/lib/Entities/index.js +31 -0
- package/lib/Interface/Controllers/setState.d.ts +1 -1
- package/lib/Interface/Controllers/setState.js +14 -3
- package/lib/PresentationManagers/DevicePreviewPM.d.ts +13 -0
- package/lib/PresentationManagers/DevicePreviewPM.js +25 -0
- package/lib/PresentationManagers/HasRedoPM.d.ts +9 -0
- package/lib/PresentationManagers/HasRedoPM.js +22 -0
- package/lib/PresentationManagers/HasUndoPM.d.ts +9 -0
- package/lib/PresentationManagers/HasUndoPM.js +22 -0
- package/lib/PresentationManagers/IsAuthoringPM.d.ts +9 -0
- package/lib/PresentationManagers/IsAuthoringPM.js +22 -0
- package/lib/PresentationManagers/OrbitCameraPM.d.ts +14 -0
- package/lib/PresentationManagers/OrbitCameraPM.js +31 -0
- package/lib/PresentationManagers/ShowBabylonInspectorPM.d.ts +9 -0
- package/lib/PresentationManagers/ShowBabylonInspectorPM.js +22 -0
- package/lib/PresentationManagers/index.d.ts +6 -0
- package/lib/PresentationManagers/index.js +18 -0
- package/lib/UseCases/LerpOrbitCamera.d.ts +36 -0
- package/lib/UseCases/LerpOrbitCamera.js +71 -0
- package/lib/UseCases/SerializeCamera.d.ts +21 -0
- package/lib/UseCases/SerializeCamera.js +59 -0
- package/lib/UseCases/SerializeOrbitCamera.d.ts +21 -0
- package/lib/UseCases/SerializeOrbitCamera.js +59 -0
- package/lib/UseCases/SerializedCamDemo.d.ts +0 -0
- package/lib/UseCases/SerializedCamDemo.js +1 -0
- package/lib/UseCases/index.d.ts +3 -0
- package/lib/UseCases/index.js +15 -0
- package/lib/UseCases/setDevicePreview.d.ts +2 -0
- package/lib/UseCases/setDevicePreview.js +14 -0
- package/lib/Utilities/degreesToRadians.d.ts +1 -0
- package/lib/Utilities/degreesToRadians.js +7 -0
- package/lib/Utilities/index.d.ts +1 -0
- package/lib/Utilities/index.js +13 -0
- package/lib/index.d.ts +7 -2
- package/lib/index.js +8 -2
- package/package.json +1 -2
- package/CHANGELOG.md +0 -51
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IsAuthoringPM = void 0;
|
|
4
|
+
class IsAuthoringPM {
|
|
5
|
+
constructor(baseApp, updateView) {
|
|
6
|
+
this.doUpdateView = () => {
|
|
7
|
+
const isAuthoring = this.baseApp.isAuthoring;
|
|
8
|
+
if (isAuthoring === this.lastSetState)
|
|
9
|
+
return;
|
|
10
|
+
this.updateView(isAuthoring);
|
|
11
|
+
this.lastSetState = isAuthoring;
|
|
12
|
+
};
|
|
13
|
+
this.baseApp = baseApp;
|
|
14
|
+
this.updateView = updateView;
|
|
15
|
+
this.doUpdateView();
|
|
16
|
+
this.baseApp.addObserver(this.doUpdateView);
|
|
17
|
+
}
|
|
18
|
+
dispose() {
|
|
19
|
+
this.baseApp.removeObserver(this.doUpdateView);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.IsAuthoringPM = IsAuthoringPM;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OrbitCamera, Vector3 } from "../Entities";
|
|
2
|
+
export interface OrbitCameraVM {
|
|
3
|
+
alphaEuler: Vector3;
|
|
4
|
+
betaEuler: Vector3;
|
|
5
|
+
cameraLocalPosition: Vector3;
|
|
6
|
+
target: Vector3;
|
|
7
|
+
}
|
|
8
|
+
export declare class OrbitCameraPM {
|
|
9
|
+
private orbitCam;
|
|
10
|
+
private view;
|
|
11
|
+
dispose(): void;
|
|
12
|
+
private doUpdateView;
|
|
13
|
+
constructor(orbitCamera: OrbitCamera, view: (vm: OrbitCameraVM) => void);
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrbitCameraPM = void 0;
|
|
4
|
+
const Entities_1 = require("../Entities");
|
|
5
|
+
const Utilities_1 = require("../Utilities");
|
|
6
|
+
class OrbitCameraPM {
|
|
7
|
+
constructor(orbitCamera, view) {
|
|
8
|
+
this.doUpdateView = () => {
|
|
9
|
+
const { alpha, beta, radius, target } = this.orbitCam;
|
|
10
|
+
const alphaRadians = Utilities_1.degreesToRadians(alpha);
|
|
11
|
+
const alphaEuler = new Entities_1.Vector3(0, alphaRadians, 0);
|
|
12
|
+
const betaRadians = Utilities_1.degreesToRadians(beta);
|
|
13
|
+
const betaEuler = new Entities_1.Vector3(betaRadians, 0, 0);
|
|
14
|
+
const cameraLocalPosition = new Entities_1.Vector3(0, 0, -radius);
|
|
15
|
+
this.view({
|
|
16
|
+
alphaEuler,
|
|
17
|
+
betaEuler,
|
|
18
|
+
cameraLocalPosition,
|
|
19
|
+
target,
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
this.orbitCam = orbitCamera;
|
|
23
|
+
this.view = view;
|
|
24
|
+
this.doUpdateView();
|
|
25
|
+
this.orbitCam.addObserver(this.doUpdateView);
|
|
26
|
+
}
|
|
27
|
+
dispose() {
|
|
28
|
+
this.orbitCam.removeObserver(this.doUpdateView);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.OrbitCameraPM = OrbitCameraPM;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Babylon } from "../Entities";
|
|
2
|
+
export declare class ShowBabylonInspectorPM {
|
|
3
|
+
private babylon;
|
|
4
|
+
private updateView;
|
|
5
|
+
private lastSetState?;
|
|
6
|
+
private doUpdateView;
|
|
7
|
+
dispose(): void;
|
|
8
|
+
constructor(babylon: Babylon, updateView: (showInspector: boolean) => void);
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShowBabylonInspectorPM = void 0;
|
|
4
|
+
class ShowBabylonInspectorPM {
|
|
5
|
+
constructor(babylon, updateView) {
|
|
6
|
+
this.doUpdateView = () => {
|
|
7
|
+
const showInspector = this.babylon.showInspector;
|
|
8
|
+
if (showInspector === this.lastSetState)
|
|
9
|
+
return;
|
|
10
|
+
this.updateView(showInspector);
|
|
11
|
+
this.lastSetState = showInspector;
|
|
12
|
+
};
|
|
13
|
+
this.babylon = babylon;
|
|
14
|
+
this.updateView = updateView;
|
|
15
|
+
this.doUpdateView();
|
|
16
|
+
this.babylon.addObserver(this.doUpdateView);
|
|
17
|
+
}
|
|
18
|
+
dispose() {
|
|
19
|
+
this.babylon.removeObserver(this.doUpdateView);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ShowBabylonInspectorPM = ShowBabylonInspectorPM;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./DevicePreviewPM"), exports);
|
|
14
|
+
__exportStar(require("./IsAuthoringPM"), exports);
|
|
15
|
+
__exportStar(require("./ShowBabylonInspectorPM"), exports);
|
|
16
|
+
__exportStar(require("./HasRedoPM"), exports);
|
|
17
|
+
__exportStar(require("./HasUndoPM"), exports);
|
|
18
|
+
__exportStar(require("./OrbitCameraPM"), exports);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { OrbitCamera } from "../Entities";
|
|
2
|
+
export interface LerpOrbitCameraParameters {
|
|
3
|
+
duration: number;
|
|
4
|
+
finalRadius?: number;
|
|
5
|
+
finalBeta?: number;
|
|
6
|
+
finalAlpha?: number;
|
|
7
|
+
finalTarget?: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
z: number;
|
|
11
|
+
};
|
|
12
|
+
onComplete?: () => void;
|
|
13
|
+
onAbort?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare class LerpOrbitCamera {
|
|
16
|
+
get isLerping(): boolean;
|
|
17
|
+
private _isLerping;
|
|
18
|
+
private orbitCamera;
|
|
19
|
+
private easeFn;
|
|
20
|
+
private lerpDuration;
|
|
21
|
+
private lerpRadius;
|
|
22
|
+
private lerpBeta;
|
|
23
|
+
private lerpAlpha;
|
|
24
|
+
private lerpX;
|
|
25
|
+
private lerpY;
|
|
26
|
+
private lerpZ;
|
|
27
|
+
private onComplete?;
|
|
28
|
+
private onAbort?;
|
|
29
|
+
private interval;
|
|
30
|
+
private chrono;
|
|
31
|
+
private delta;
|
|
32
|
+
cancelLerp: () => void;
|
|
33
|
+
private onTick;
|
|
34
|
+
constructor(orbitCamera: OrbitCamera, easeFn: (normalizedTime: number) => number, parameters: LerpOrbitCameraParameters);
|
|
35
|
+
private makeLerpNumber;
|
|
36
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LerpOrbitCamera = void 0;
|
|
4
|
+
const Entities_1 = require("../Entities");
|
|
5
|
+
class LerpOrbitCamera {
|
|
6
|
+
constructor(orbitCamera, easeFn, parameters) {
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
this._isLerping = false;
|
|
9
|
+
this.chrono = 0;
|
|
10
|
+
this.delta = 10;
|
|
11
|
+
this.cancelLerp = () => {
|
|
12
|
+
if (!this._isLerping)
|
|
13
|
+
return;
|
|
14
|
+
clearInterval(this.interval);
|
|
15
|
+
if (this.onAbort) {
|
|
16
|
+
this.onAbort();
|
|
17
|
+
}
|
|
18
|
+
this._isLerping = false;
|
|
19
|
+
};
|
|
20
|
+
this.onTick = () => {
|
|
21
|
+
this.chrono = this.chrono + this.delta / 1000;
|
|
22
|
+
let nomralizedTime = this.chrono / this.lerpDuration;
|
|
23
|
+
if (nomralizedTime > 1) {
|
|
24
|
+
nomralizedTime = 1;
|
|
25
|
+
}
|
|
26
|
+
const percent = this.easeFn(nomralizedTime);
|
|
27
|
+
this.orbitCamera.radius = this.lerpRadius(percent);
|
|
28
|
+
this.orbitCamera.beta = this.lerpBeta(percent);
|
|
29
|
+
this.orbitCamera.alpha = this.lerpAlpha(percent);
|
|
30
|
+
const x = this.lerpX(percent);
|
|
31
|
+
const y = this.lerpY(percent);
|
|
32
|
+
const z = this.lerpZ(percent);
|
|
33
|
+
this.orbitCamera.target = new Entities_1.Vector3(x, y, z);
|
|
34
|
+
if (nomralizedTime >= 1) {
|
|
35
|
+
clearInterval(this.interval);
|
|
36
|
+
if (this.onComplete) {
|
|
37
|
+
this.onComplete();
|
|
38
|
+
}
|
|
39
|
+
this._isLerping = false;
|
|
40
|
+
this.orbitCamera.lerpCompleted();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
this.orbitCamera = orbitCamera;
|
|
44
|
+
this.easeFn = easeFn;
|
|
45
|
+
this.lerpDuration = parameters.duration;
|
|
46
|
+
this.onComplete = parameters.onComplete;
|
|
47
|
+
this.onAbort = parameters.onAbort;
|
|
48
|
+
this.lerpRadius = this.makeLerpNumber(this.orbitCamera.radius, parameters.finalRadius);
|
|
49
|
+
this.lerpBeta = this.makeLerpNumber(this.orbitCamera.beta, parameters.finalBeta);
|
|
50
|
+
this.lerpAlpha = this.makeLerpNumber(this.orbitCamera.alpha, parameters.finalAlpha);
|
|
51
|
+
this.lerpX = this.makeLerpNumber(this.orbitCamera.target.x, (_a = parameters.finalTarget) === null || _a === void 0 ? void 0 : _a.x);
|
|
52
|
+
this.lerpY = this.makeLerpNumber(this.orbitCamera.target.y, (_b = parameters.finalTarget) === null || _b === void 0 ? void 0 : _b.y);
|
|
53
|
+
this.lerpZ = this.makeLerpNumber(this.orbitCamera.target.z, (_c = parameters.finalTarget) === null || _c === void 0 ? void 0 : _c.z);
|
|
54
|
+
this.interval = setInterval(() => {
|
|
55
|
+
this.onTick();
|
|
56
|
+
}, this.delta);
|
|
57
|
+
this.orbitCamera.registerLerp(this);
|
|
58
|
+
this._isLerping = true;
|
|
59
|
+
}
|
|
60
|
+
get isLerping() {
|
|
61
|
+
return this._isLerping;
|
|
62
|
+
}
|
|
63
|
+
makeLerpNumber(initial, final) {
|
|
64
|
+
const actualFinal = final !== null && final !== void 0 ? final : initial;
|
|
65
|
+
return function Lerp(percent) {
|
|
66
|
+
const range = actualFinal - initial;
|
|
67
|
+
return initial + range * percent;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.LerpOrbitCamera = LerpOrbitCamera;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { OrbitCamera, SerializedSystem, StateMachine } from "../Entities";
|
|
2
|
+
export declare class SerializedCamera implements SerializedSystem {
|
|
3
|
+
name: string;
|
|
4
|
+
seriliziationVersion: number;
|
|
5
|
+
private orbitCamera;
|
|
6
|
+
private stateMachine;
|
|
7
|
+
private defaultState?;
|
|
8
|
+
getSystemState(): object;
|
|
9
|
+
applySystemState(serializedState: object, version: number, transitionTime: number): void;
|
|
10
|
+
applyDefaultState(transitionDuration: number): void;
|
|
11
|
+
private applyV1Data;
|
|
12
|
+
constructor(orbitCamera: OrbitCamera, stateMachine: StateMachine, defaultState?: CameraDataV1);
|
|
13
|
+
}
|
|
14
|
+
export interface CameraDataV1 {
|
|
15
|
+
alpha: number;
|
|
16
|
+
beta: number;
|
|
17
|
+
radius: number;
|
|
18
|
+
target_x: number;
|
|
19
|
+
target_y: number;
|
|
20
|
+
target_z: number;
|
|
21
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SerializedCamera = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const Entities_1 = require("../Entities");
|
|
6
|
+
class SerializedCamera {
|
|
7
|
+
constructor(orbitCamera, stateMachine, defaultState) {
|
|
8
|
+
this.name = "orbitCamera";
|
|
9
|
+
this.seriliziationVersion = 1;
|
|
10
|
+
this.orbitCamera = orbitCamera;
|
|
11
|
+
this.stateMachine = stateMachine;
|
|
12
|
+
this.defaultState = defaultState;
|
|
13
|
+
stateMachine.registerSerializedSystem(this);
|
|
14
|
+
}
|
|
15
|
+
getSystemState() {
|
|
16
|
+
const data = {
|
|
17
|
+
alpha: this.orbitCamera.alpha,
|
|
18
|
+
beta: this.orbitCamera.beta,
|
|
19
|
+
radius: this.orbitCamera.radius,
|
|
20
|
+
target_x: this.orbitCamera.target.x,
|
|
21
|
+
target_y: this.orbitCamera.target.y,
|
|
22
|
+
target_z: this.orbitCamera.target.z,
|
|
23
|
+
};
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
applySystemState(serializedState, version, transitionTime) {
|
|
27
|
+
try {
|
|
28
|
+
if (version === 1) {
|
|
29
|
+
const castState = serializedState;
|
|
30
|
+
this.applyV1Data(castState, transitionTime);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
console.warn(`[SerializedCamera] Unsupported version number ${version}. Defaulting`);
|
|
34
|
+
this.applyDefaultState(transitionTime);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
console.warn(`[SerializedCamera] Caught when deserializing ${e}. Defaulting`);
|
|
39
|
+
this.applyDefaultState(transitionTime);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
applyDefaultState(transitionDuration) {
|
|
43
|
+
if (this.defaultState) {
|
|
44
|
+
this.applyV1Data(this.defaultState, transitionDuration);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
applyV1Data(data, transitionTime) {
|
|
48
|
+
const { alpha, beta, radius, target_x, target_y, target_z } = data;
|
|
49
|
+
const lerpParams = {
|
|
50
|
+
duration: transitionTime,
|
|
51
|
+
finalRadius: radius,
|
|
52
|
+
finalBeta: beta,
|
|
53
|
+
finalAlpha: alpha,
|
|
54
|
+
finalTarget: new Entities_1.Vector3(target_x, target_y, target_z),
|
|
55
|
+
};
|
|
56
|
+
new _1.LerpOrbitCamera(this.orbitCamera, this.stateMachine.transitionEaseFunction, lerpParams);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.SerializedCamera = SerializedCamera;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { OrbitCamera, SerializedSystem, StateMachine } from "../Entities";
|
|
2
|
+
export declare class SerializedOrbitCamera implements SerializedSystem {
|
|
3
|
+
name: string;
|
|
4
|
+
seriliziationVersion: number;
|
|
5
|
+
private orbitCamera;
|
|
6
|
+
private stateMachine;
|
|
7
|
+
private defaultState?;
|
|
8
|
+
getSystemState(): object;
|
|
9
|
+
applySystemState(serializedState: object, version: number, transitionTime: number): void;
|
|
10
|
+
applyDefaultState(transitionDuration: number): void;
|
|
11
|
+
private applyV1Data;
|
|
12
|
+
constructor(orbitCamera: OrbitCamera, stateMachine: StateMachine, defaultState?: CameraDataV1);
|
|
13
|
+
}
|
|
14
|
+
export interface CameraDataV1 {
|
|
15
|
+
alpha: number;
|
|
16
|
+
beta: number;
|
|
17
|
+
radius: number;
|
|
18
|
+
target_x: number;
|
|
19
|
+
target_y: number;
|
|
20
|
+
target_z: number;
|
|
21
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SerializedOrbitCamera = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const Entities_1 = require("../Entities");
|
|
6
|
+
class SerializedOrbitCamera {
|
|
7
|
+
constructor(orbitCamera, stateMachine, defaultState) {
|
|
8
|
+
this.name = "orbitCamera";
|
|
9
|
+
this.seriliziationVersion = 1;
|
|
10
|
+
this.orbitCamera = orbitCamera;
|
|
11
|
+
this.stateMachine = stateMachine;
|
|
12
|
+
this.defaultState = defaultState;
|
|
13
|
+
stateMachine.registerSerializedSystem(this);
|
|
14
|
+
}
|
|
15
|
+
getSystemState() {
|
|
16
|
+
const data = {
|
|
17
|
+
alpha: this.orbitCamera.alpha,
|
|
18
|
+
beta: this.orbitCamera.beta,
|
|
19
|
+
radius: this.orbitCamera.radius,
|
|
20
|
+
target_x: this.orbitCamera.target.x,
|
|
21
|
+
target_y: this.orbitCamera.target.y,
|
|
22
|
+
target_z: this.orbitCamera.target.z,
|
|
23
|
+
};
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
applySystemState(serializedState, version, transitionTime) {
|
|
27
|
+
try {
|
|
28
|
+
if (version === 1) {
|
|
29
|
+
const castState = serializedState;
|
|
30
|
+
this.applyV1Data(castState, transitionTime);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
console.warn(`[SerializedCamera] Unsupported version number ${version}. Defaulting`);
|
|
34
|
+
this.applyDefaultState(transitionTime);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
console.warn(`[SerializedCamera] Caught when deserializing ${e}. Defaulting`);
|
|
39
|
+
this.applyDefaultState(transitionTime);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
applyDefaultState(transitionDuration) {
|
|
43
|
+
if (this.defaultState) {
|
|
44
|
+
this.applyV1Data(this.defaultState, transitionDuration);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
applyV1Data(data, transitionTime) {
|
|
48
|
+
const { alpha, beta, radius, target_x, target_y, target_z } = data;
|
|
49
|
+
const lerpParams = {
|
|
50
|
+
duration: transitionTime,
|
|
51
|
+
finalRadius: radius,
|
|
52
|
+
finalBeta: beta,
|
|
53
|
+
finalAlpha: alpha,
|
|
54
|
+
finalTarget: new Entities_1.Vector3(target_x, target_y, target_z),
|
|
55
|
+
};
|
|
56
|
+
new _1.LerpOrbitCamera(this.orbitCamera, this.stateMachine.transitionEaseFunction, lerpParams);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.SerializedOrbitCamera = SerializedOrbitCamera;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./setDevicePreview"), exports);
|
|
14
|
+
__exportStar(require("./LerpOrbitCamera"), exports);
|
|
15
|
+
__exportStar(require("./SerializeOrbitCamera"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeSetDevicePreview = void 0;
|
|
4
|
+
function makeSetDevicePreview(devicePreview) {
|
|
5
|
+
return function setDevicePreview(x, y) {
|
|
6
|
+
if (x <= 0 || y <= 0) {
|
|
7
|
+
devicePreview.clearDevicePreview();
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
devicePreview.setDevicePreview(x, y);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.makeSetDevicePreview = makeSetDevicePreview;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function degreesToRadians(deg: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./degreesToRadians";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./degreesToRadians"), exports);
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import * as AppPMs from "./PresentationManagers";
|
|
2
|
+
export { AppPMs };
|
|
3
|
+
import * as AppUCs from "./UseCases";
|
|
4
|
+
export { AppUCs };
|
|
5
|
+
import * as AppEntities from "./Entities";
|
|
6
|
+
export { AppEntities };
|
|
7
|
+
export * from "./Utilities";
|
package/lib/index.js
CHANGED
|
@@ -10,5 +10,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
exports.AppEntities = exports.AppUCs = exports.AppPMs = void 0;
|
|
14
|
+
const AppPMs = require("./PresentationManagers");
|
|
15
|
+
exports.AppPMs = AppPMs;
|
|
16
|
+
const AppUCs = require("./UseCases");
|
|
17
|
+
exports.AppUCs = AppUCs;
|
|
18
|
+
const AppEntities = require("./Entities");
|
|
19
|
+
exports.AppEntities = AppEntities;
|
|
20
|
+
__exportStar(require("./Utilities"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vived/app",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Public package for the VIVED Learning App system",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"homepage": "https://bitbucket.org/cyberscience3d/vivedlearning_app#readme",
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/jest": "^26.0.22",
|
|
31
|
-
"@vived/app-host-boundary": "^3.2.0",
|
|
32
31
|
"jest": "^26.6.3",
|
|
33
32
|
"prettier": "^2.2.1",
|
|
34
33
|
"ts-jest": "^26.5.4",
|
package/CHANGELOG.md
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
All notable changes to this project will be documented in this file.
|
|
3
|
-
|
|
4
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
-
## [2.4.0] - 2021-7-9
|
|
7
|
-
### Changed
|
|
8
|
-
- Change the Device Peview PM to return a view model
|
|
9
|
-
- Changed system name BaseAppState to BaseApp
|
|
10
|
-
- Merged Serilization into Base App
|
|
11
|
-
- Merged Dispatch to Host into Base App
|
|
12
|
-
- Merged Device Preview into Base App
|
|
13
|
-
## [2.3.0] - 2021-7-7
|
|
14
|
-
### Changed
|
|
15
|
-
- Converted the App Handler into a factory
|
|
16
|
-
### Added
|
|
17
|
-
- Serilization system
|
|
18
|
-
- A lot of app systems controlles and PMs
|
|
19
|
-
## [2.2.0] - 2021-07-1
|
|
20
|
-
### Changed
|
|
21
|
-
- Start to payload version 2
|
|
22
|
-
- Set state to payload version 2
|
|
23
|
-
## [2.1.0] - 2021-06-28
|
|
24
|
-
### Added
|
|
25
|
-
- Support for responding to requsting app response payload versions
|
|
26
|
-
## [2.0.0] - 2021-06-28
|
|
27
|
-
### Removed
|
|
28
|
-
- React and the hook
|
|
29
|
-
## [1.2.0] - 2021-06-28
|
|
30
|
-
### Added
|
|
31
|
-
- Support for host communication via the 3rd gen boundary
|
|
32
|
-
## [1.1.0] - 2021-04-26
|
|
33
|
-
### Changed
|
|
34
|
-
- General refactor on project structure
|
|
35
|
-
- Renamed the package to @VIVED
|
|
36
|
-
### Added
|
|
37
|
-
- A Set Device Preview controller
|
|
38
|
-
|
|
39
|
-
## [1.0.0] - 2021-04-20
|
|
40
|
-
### Changed
|
|
41
|
-
- Setup the readme file
|
|
42
|
-
### Removed
|
|
43
|
-
- All the boundary interfaces. These were moved to a seperate package.
|
|
44
|
-
|
|
45
|
-
## [0.0.2] - 2021-04-06
|
|
46
|
-
### Added
|
|
47
|
-
- Old version of the App Interface
|
|
48
|
-
|
|
49
|
-
## [0.0.1] - 2021-04-06
|
|
50
|
-
### Added
|
|
51
|
-
- Initial setup
|