@vived/app 3.4.0 → 3.5.1
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/AppObjectComponents/Dispatcher/Factories/makeBasicDispatcher.js +8 -0
- package/lib/AppObjectComponents/Dispatcher/UC/GoToNextStateUC.d.ts +10 -0
- package/lib/AppObjectComponents/Dispatcher/UC/GoToNextStateUC.js +44 -0
- package/lib/AppObjectComponents/Dispatcher/UC/GoToPreviousStateUC.d.ts +10 -0
- package/lib/AppObjectComponents/Dispatcher/UC/GoToPreviousStateUC.js +44 -0
- package/lib/AppObjectComponents/Dispatcher/UC/HasNextStateUC.d.ts +10 -0
- package/lib/AppObjectComponents/Dispatcher/UC/HasNextStateUC.js +54 -0
- package/lib/AppObjectComponents/Dispatcher/UC/HasPreviousStateUC.d.ts +10 -0
- package/lib/AppObjectComponents/Dispatcher/UC/HasPreviousStateUC.js +54 -0
- package/lib/AppObjectComponents/Dispatcher/index.d.ts +4 -0
- package/lib/AppObjectComponents/Dispatcher/index.js +4 -0
- package/lib/AppObjectComponents/StoredView/Entities/StoredView.d.ts +13 -0
- package/lib/AppObjectComponents/StoredView/Entities/StoredView.js +64 -0
- package/lib/AppObjectComponents/StoredView/UC/SerializeStoredView.d.ts +27 -0
- package/lib/AppObjectComponents/StoredView/UC/SerializeStoredView.js +82 -0
- package/lib/AppObjectComponents/StoredView/index.d.ts +2 -0
- package/lib/AppObjectComponents/StoredView/index.js +14 -0
- package/lib/AppObjectComponents/Transform3D/UseCases/StickTransform3D.js +10 -2
- package/lib/Entities/AppDispatcher.d.ts +0 -4
- package/lib/Entities/AppDispatcher.js +0 -38
- package/lib/Entities/FocusCamera.d.ts +70 -0
- package/lib/Entities/FocusCamera.js +272 -0
- package/lib/Entities/MemoizedBoolean.d.ts +8 -0
- package/lib/Entities/MemoizedBoolean.js +22 -0
- package/lib/Entities/MemoizedNumber.d.ts +8 -0
- package/lib/Entities/MemoizedNumber.js +22 -0
- package/lib/Entities/MemoizedQuaternion.d.ts +9 -0
- package/lib/Entities/MemoizedQuaternion.js +23 -0
- package/lib/Entities/MemoizedString.d.ts +8 -0
- package/lib/Entities/MemoizedString.js +22 -0
- package/lib/Entities/MemoizedVector2.d.ts +9 -0
- package/lib/Entities/MemoizedVector2.js +23 -0
- package/lib/Entities/MemoizedVector3.d.ts +9 -0
- package/lib/Entities/MemoizedVector3.js +23 -0
- package/lib/Entities/MeshModel.d.ts +68 -0
- package/lib/Entities/MeshModel.js +174 -0
- package/lib/Entities/ModelObject.d.ts +10 -0
- package/lib/Entities/ModelObject.js +42 -0
- package/lib/PresentationManagers/FocusCameraPM.d.ts +15 -0
- package/lib/PresentationManagers/FocusCameraPM.js +31 -0
- package/lib/PresentationManagers/FocusCameraPosRotPM.d.ts +13 -0
- package/lib/PresentationManagers/FocusCameraPosRotPM.js +28 -0
- package/lib/PresentationManagers/SceneModel/SceneMeshOverlayPM.d.ts +15 -0
- package/lib/PresentationManagers/SceneModel/SceneMeshOverlayPM.js +34 -0
- package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.d.ts +17 -0
- package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.js +64 -0
- package/lib/UseCases/FocusCamera/LerpFocusCamera.d.ts +36 -0
- package/lib/UseCases/FocusCamera/LerpFocusCamera.js +71 -0
- package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.d.ts +11 -0
- package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.js +36 -0
- package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.d.ts +11 -0
- package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.js +36 -0
- package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.d.ts +11 -0
- package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.js +26 -0
- package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.d.ts +11 -0
- package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.js +33 -0
- package/lib/UseCases/FocusCamera/SerializeFocusCamera.d.ts +22 -0
- package/lib/UseCases/FocusCamera/SerializeFocusCamera.js +81 -0
- package/lib/UseCases/FocusCamera/index.d.ts +7 -0
- package/lib/UseCases/FocusCamera/index.js +19 -0
- package/lib/UseCases/SceneModel/SerializeActiveModel.d.ts +18 -0
- package/lib/UseCases/SceneModel/SerializeActiveModel.js +74 -0
- package/lib/UseCases/SceneModel/SetMeshesEnabledHook.d.ts +7 -0
- package/lib/UseCases/SceneModel/SetMeshesEnabledHook.js +22 -0
- package/lib/UseCases/SceneModel/SetSceneModelMeshOverlayColor.d.ts +2 -0
- package/lib/UseCases/SceneModel/SetSceneModelMeshOverlayColor.js +13 -0
- package/lib/UseCases/SceneModel/index.d.ts +3 -0
- package/lib/UseCases/SceneModel/index.js +3 -0
- package/lib/UseCases/SceneModel/loadNewModel.d.ts +2 -2
- package/lib/UseCases/SceneModel/loadNewModel.js +17 -15
- package/lib/UseCases/SceneObjects/PeelSceneObject.d.ts +18 -0
- package/lib/UseCases/SceneObjects/PeelSceneObject.js +61 -0
- package/lib/UseCases/SceneObjects/index.d.ts +1 -0
- package/lib/UseCases/SceneObjects/index.js +13 -0
- package/package.json +1 -1
- package/lib/AppObject/IsEnabledPM.d.ts +0 -11
- package/lib/AppObject/IsEnabledPM.js +0 -29
- package/lib/AppObjectComponents/Transform3D/UseCases/getStickUC.d.ts +0 -3
- package/lib/AppObjectComponents/Transform3D/UseCases/getStickUC.js +0 -8
|
@@ -3,11 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.makeBasicDispatcher = exports.APP_DISPATCHER_ID = void 0;
|
|
4
4
|
const AppDispatcher_1 = require("../Entities/AppDispatcher");
|
|
5
5
|
const DispatchStopZSpaceUC_1 = require("../UC/DispatchStopZSpaceUC");
|
|
6
|
+
const GoToNextStateUC_1 = require("../UC/GoToNextStateUC");
|
|
7
|
+
const GoToPreviousStateUC_1 = require("../UC/GoToPreviousStateUC");
|
|
8
|
+
const HasNextStateUC_1 = require("../UC/HasNextStateUC");
|
|
9
|
+
const HasPreviousStateUC_1 = require("../UC/HasPreviousStateUC");
|
|
6
10
|
exports.APP_DISPATCHER_ID = "AppDispatcher";
|
|
7
11
|
function makeBasicDispatcher(appObjects, hostHandler) {
|
|
8
12
|
const dispatcherAO = appObjects.getOrCreate(exports.APP_DISPATCHER_ID);
|
|
9
13
|
AppDispatcher_1.makeAppDispatcher(dispatcherAO, hostHandler);
|
|
10
14
|
DispatchStopZSpaceUC_1.makeDispatchStopZSpaceUC(dispatcherAO);
|
|
15
|
+
GoToPreviousStateUC_1.makeGoToPreviousStateUC(dispatcherAO);
|
|
16
|
+
GoToNextStateUC_1.makeGoToNextStateUC(dispatcherAO);
|
|
17
|
+
HasPreviousStateUC_1.makeHasPreviousStateUC(dispatcherAO);
|
|
18
|
+
HasNextStateUC_1.makeHasNextStateUC(dispatcherAO);
|
|
11
19
|
return dispatcherAO;
|
|
12
20
|
}
|
|
13
21
|
exports.makeBasicDispatcher = makeBasicDispatcher;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AppObject } from "../../../AppObject/AppObject";
|
|
2
|
+
import { AppObjectRepo } from "../../../AppObject/AppObjectRepo";
|
|
3
|
+
import { AppObjectUC } from "../../../AppObject/AppObjectUC";
|
|
4
|
+
export declare abstract class GoToNextStateUC extends AppObjectUC {
|
|
5
|
+
static readonly type = "GoToNextStateUC";
|
|
6
|
+
readonly requestType = "GO_TO_NEXT_STATE";
|
|
7
|
+
abstract doDispatch(): void;
|
|
8
|
+
static get(appObjects: AppObjectRepo): GoToNextStateUC | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function makeGoToNextStateUC(appObject: AppObject): GoToNextStateUC;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeGoToNextStateUC = exports.GoToNextStateUC = void 0;
|
|
4
|
+
const AppObjectUC_1 = require("../../../AppObject/AppObjectUC");
|
|
5
|
+
const AppDispatcher_1 = require("../Entities/AppDispatcher");
|
|
6
|
+
class GoToNextStateUC extends AppObjectUC_1.AppObjectUC {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.requestType = "GO_TO_NEXT_STATE";
|
|
10
|
+
}
|
|
11
|
+
static get(appObjects) {
|
|
12
|
+
const selectionEntities = appObjects.getAllComponents(GoToNextStateUC.type);
|
|
13
|
+
if (selectionEntities.length === 0) {
|
|
14
|
+
console.warn("Unable to find a GoToNextStateUC. Add one on Mount");
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
else if (selectionEntities.length > 1) {
|
|
18
|
+
console.warn("Multiple GoToNextStateUC have been found. There should only be one. Using the first one");
|
|
19
|
+
}
|
|
20
|
+
return selectionEntities[0];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.GoToNextStateUC = GoToNextStateUC;
|
|
24
|
+
GoToNextStateUC.type = "GoToNextStateUC";
|
|
25
|
+
function makeGoToNextStateUC(appObject) {
|
|
26
|
+
return new DispatchStateChangeUCImp(appObject);
|
|
27
|
+
}
|
|
28
|
+
exports.makeGoToNextStateUC = makeGoToNextStateUC;
|
|
29
|
+
class DispatchStateChangeUCImp extends GoToNextStateUC {
|
|
30
|
+
constructor(appObject) {
|
|
31
|
+
super(appObject, GoToNextStateUC.type);
|
|
32
|
+
this.requestVersion = 1;
|
|
33
|
+
this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
|
|
34
|
+
if (!this.appDispatcher) {
|
|
35
|
+
console.warn("GoToNextStateUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
|
|
36
|
+
this.dispose();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
doDispatch() {
|
|
40
|
+
if (!this.appDispatcher)
|
|
41
|
+
return;
|
|
42
|
+
this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AppObject } from "../../../AppObject/AppObject";
|
|
2
|
+
import { AppObjectRepo } from "../../../AppObject/AppObjectRepo";
|
|
3
|
+
import { AppObjectUC } from "../../../AppObject/AppObjectUC";
|
|
4
|
+
export declare abstract class GoToPreviousStateUC extends AppObjectUC {
|
|
5
|
+
static readonly type = "GoToPreviousStateUC";
|
|
6
|
+
readonly requestType = "GO_TO_PREVIOUS_STATE";
|
|
7
|
+
abstract doDispatch(): void;
|
|
8
|
+
static get(appObjects: AppObjectRepo): GoToPreviousStateUC | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function makeGoToPreviousStateUC(appObject: AppObject): GoToPreviousStateUC;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeGoToPreviousStateUC = exports.GoToPreviousStateUC = void 0;
|
|
4
|
+
const AppObjectUC_1 = require("../../../AppObject/AppObjectUC");
|
|
5
|
+
const AppDispatcher_1 = require("../Entities/AppDispatcher");
|
|
6
|
+
class GoToPreviousStateUC extends AppObjectUC_1.AppObjectUC {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.requestType = "GO_TO_PREVIOUS_STATE";
|
|
10
|
+
}
|
|
11
|
+
static get(appObjects) {
|
|
12
|
+
const selectionEntities = appObjects.getAllComponents(GoToPreviousStateUC.type);
|
|
13
|
+
if (selectionEntities.length === 0) {
|
|
14
|
+
console.warn("Unable to find a GoToPreviousStateUC. Add one on Mount");
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
else if (selectionEntities.length > 1) {
|
|
18
|
+
console.warn("Multiple GoToPreviousStateUC have been found. There should only be one. Using the first one");
|
|
19
|
+
}
|
|
20
|
+
return selectionEntities[0];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.GoToPreviousStateUC = GoToPreviousStateUC;
|
|
24
|
+
GoToPreviousStateUC.type = "GoToPreviousStateUC";
|
|
25
|
+
function makeGoToPreviousStateUC(appObject) {
|
|
26
|
+
return new DispatchStateChangeUCImp(appObject);
|
|
27
|
+
}
|
|
28
|
+
exports.makeGoToPreviousStateUC = makeGoToPreviousStateUC;
|
|
29
|
+
class DispatchStateChangeUCImp extends GoToPreviousStateUC {
|
|
30
|
+
constructor(appObject) {
|
|
31
|
+
super(appObject, GoToPreviousStateUC.type);
|
|
32
|
+
this.requestVersion = 1;
|
|
33
|
+
this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
|
|
34
|
+
if (!this.appDispatcher) {
|
|
35
|
+
console.warn("GoToPreviousStateUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
|
|
36
|
+
this.dispose();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
doDispatch() {
|
|
40
|
+
if (!this.appDispatcher)
|
|
41
|
+
return;
|
|
42
|
+
this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AppObject } from "../../../AppObject/AppObject";
|
|
2
|
+
import { AppObjectRepo } from "../../../AppObject/AppObjectRepo";
|
|
3
|
+
import { AppObjectUC } from "../../../AppObject/AppObjectUC";
|
|
4
|
+
export declare abstract class HasNextStateUC extends AppObjectUC {
|
|
5
|
+
static readonly type = "HasNextStateUC";
|
|
6
|
+
readonly requestType = "HAS_NEXT_STATE";
|
|
7
|
+
abstract doDispatch(): Promise<boolean>;
|
|
8
|
+
static get(appObjects: AppObjectRepo): HasNextStateUC | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function makeHasNextStateUC(appObject: AppObject): HasNextStateUC;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeHasNextStateUC = exports.HasNextStateUC = void 0;
|
|
4
|
+
const AppObjectUC_1 = require("../../../AppObject/AppObjectUC");
|
|
5
|
+
const AppDispatcher_1 = require("../Entities/AppDispatcher");
|
|
6
|
+
class HasNextStateUC extends AppObjectUC_1.AppObjectUC {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.requestType = "HAS_NEXT_STATE";
|
|
10
|
+
}
|
|
11
|
+
static get(appObjects) {
|
|
12
|
+
const selectionEntities = appObjects.getAllComponents(HasNextStateUC.type);
|
|
13
|
+
if (selectionEntities.length === 0) {
|
|
14
|
+
console.warn("Unable to find a HasNextStateUC. Add one on Mount");
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
else if (selectionEntities.length > 1) {
|
|
18
|
+
console.warn("Multiple HasNextStateUC have been found. There should only be one. Using the first one");
|
|
19
|
+
}
|
|
20
|
+
return selectionEntities[0];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.HasNextStateUC = HasNextStateUC;
|
|
24
|
+
HasNextStateUC.type = "HasNextStateUC";
|
|
25
|
+
function makeHasNextStateUC(appObject) {
|
|
26
|
+
return new DispatchStateChangeUCImp(appObject);
|
|
27
|
+
}
|
|
28
|
+
exports.makeHasNextStateUC = makeHasNextStateUC;
|
|
29
|
+
class DispatchStateChangeUCImp extends HasNextStateUC {
|
|
30
|
+
constructor(appObject) {
|
|
31
|
+
super(appObject, HasNextStateUC.type);
|
|
32
|
+
this.requestVersion = 1;
|
|
33
|
+
this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
|
|
34
|
+
if (!this.appDispatcher) {
|
|
35
|
+
console.warn("HasNextStateUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
|
|
36
|
+
this.dispose();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
doDispatch() {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
const callback = (hasNextState) => {
|
|
42
|
+
resolve(hasNextState);
|
|
43
|
+
};
|
|
44
|
+
const payload = {
|
|
45
|
+
callback,
|
|
46
|
+
};
|
|
47
|
+
if (!this.appDispatcher)
|
|
48
|
+
return reject(new Error("No host handler has been registered"));
|
|
49
|
+
else {
|
|
50
|
+
this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AppObject } from "../../../AppObject/AppObject";
|
|
2
|
+
import { AppObjectRepo } from "../../../AppObject/AppObjectRepo";
|
|
3
|
+
import { AppObjectUC } from "../../../AppObject/AppObjectUC";
|
|
4
|
+
export declare abstract class HasPreviousStateUC extends AppObjectUC {
|
|
5
|
+
static readonly type = "HasPreviousStateUC";
|
|
6
|
+
readonly requestType = "HAS_PREVIOUS_STATE";
|
|
7
|
+
abstract doDispatch(): Promise<boolean>;
|
|
8
|
+
static get(appObjects: AppObjectRepo): HasPreviousStateUC | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function makeHasPreviousStateUC(appObject: AppObject): HasPreviousStateUC;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeHasPreviousStateUC = exports.HasPreviousStateUC = void 0;
|
|
4
|
+
const AppObjectUC_1 = require("../../../AppObject/AppObjectUC");
|
|
5
|
+
const AppDispatcher_1 = require("../Entities/AppDispatcher");
|
|
6
|
+
class HasPreviousStateUC extends AppObjectUC_1.AppObjectUC {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.requestType = "HAS_PREVIOUS_STATE";
|
|
10
|
+
}
|
|
11
|
+
static get(appObjects) {
|
|
12
|
+
const selectionEntities = appObjects.getAllComponents(HasPreviousStateUC.type);
|
|
13
|
+
if (selectionEntities.length === 0) {
|
|
14
|
+
console.warn("Unable to find a HasPreviousStateUC. Add one on Mount");
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
else if (selectionEntities.length > 1) {
|
|
18
|
+
console.warn("Multiple HasPreviousStateUC have been found. There should only be one. Using the first one");
|
|
19
|
+
}
|
|
20
|
+
return selectionEntities[0];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.HasPreviousStateUC = HasPreviousStateUC;
|
|
24
|
+
HasPreviousStateUC.type = "HasPreviousStateUC";
|
|
25
|
+
function makeHasPreviousStateUC(appObject) {
|
|
26
|
+
return new DispatchStateChangeUCImp(appObject);
|
|
27
|
+
}
|
|
28
|
+
exports.makeHasPreviousStateUC = makeHasPreviousStateUC;
|
|
29
|
+
class DispatchStateChangeUCImp extends HasPreviousStateUC {
|
|
30
|
+
constructor(appObject) {
|
|
31
|
+
super(appObject, HasPreviousStateUC.type);
|
|
32
|
+
this.requestVersion = 1;
|
|
33
|
+
this.appDispatcher = appObject.getComponent(AppDispatcher_1.AppDispatcher.type);
|
|
34
|
+
if (!this.appDispatcher) {
|
|
35
|
+
console.warn("HasPreviousStateUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
|
|
36
|
+
this.dispose();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
doDispatch() {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
const callback = (hasNextState) => {
|
|
42
|
+
resolve(hasNextState);
|
|
43
|
+
};
|
|
44
|
+
const payload = {
|
|
45
|
+
callback,
|
|
46
|
+
};
|
|
47
|
+
if (!this.appDispatcher)
|
|
48
|
+
return reject(new Error("No host handler has been registered"));
|
|
49
|
+
else {
|
|
50
|
+
this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion, payload);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export * from "./Entities/AppDispatcher";
|
|
2
2
|
export * from "./Factories/makeBasicDispatcher";
|
|
3
3
|
export * from "./UC/DispatchStopZSpaceUC";
|
|
4
|
+
export * from "./UC/GoToNextStateUC";
|
|
5
|
+
export * from "./UC/GoToPreviousStateUC";
|
|
6
|
+
export * from "./UC/HasNextStateUC";
|
|
7
|
+
export * from "./UC/HasPreviousStateUC";
|
|
@@ -13,3 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
__exportStar(require("./Entities/AppDispatcher"), exports);
|
|
14
14
|
__exportStar(require("./Factories/makeBasicDispatcher"), exports);
|
|
15
15
|
__exportStar(require("./UC/DispatchStopZSpaceUC"), exports);
|
|
16
|
+
__exportStar(require("./UC/GoToNextStateUC"), exports);
|
|
17
|
+
__exportStar(require("./UC/GoToPreviousStateUC"), exports);
|
|
18
|
+
__exportStar(require("./UC/HasNextStateUC"), exports);
|
|
19
|
+
__exportStar(require("./UC/HasPreviousStateUC"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AppObject } from "../../../AppObject/AppObject";
|
|
2
|
+
import { AppObjectEntity } from "../../../AppObject/AppObjectEntity";
|
|
3
|
+
import { AppObjectRepo } from "../../../AppObject/AppObjectRepo";
|
|
4
|
+
import { Quaternion, Vector3 } from "../../../ValueObjects";
|
|
5
|
+
export declare abstract class StoredView extends AppObjectEntity {
|
|
6
|
+
static readonly type = "STORED_VIEW";
|
|
7
|
+
abstract position: Vector3;
|
|
8
|
+
abstract rotation: Quaternion;
|
|
9
|
+
abstract scale: number;
|
|
10
|
+
abstract hasStoredView: boolean;
|
|
11
|
+
static get(appObjects: AppObjectRepo): StoredView | undefined;
|
|
12
|
+
}
|
|
13
|
+
export declare function makeStoredView(appObj: AppObject): StoredView;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeStoredView = exports.StoredView = void 0;
|
|
4
|
+
const AppObjectEntity_1 = require("../../../AppObject/AppObjectEntity");
|
|
5
|
+
const Entities_1 = require("../../../Entities");
|
|
6
|
+
const ValueObjects_1 = require("../../../ValueObjects");
|
|
7
|
+
class StoredView extends AppObjectEntity_1.AppObjectEntity {
|
|
8
|
+
static get(appObjects) {
|
|
9
|
+
const repo = appObjects.getAllComponents(StoredView.type);
|
|
10
|
+
if (repo.length === 0) {
|
|
11
|
+
console.warn("[StoredView] Unable to find Scene Root Entity. Add one on Mount");
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
else if (repo.length > 1) {
|
|
15
|
+
console.warn("[StoredView] Multiple Scene Root Entity have been found. There should only be one. Using the first one");
|
|
16
|
+
}
|
|
17
|
+
return repo[0];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.StoredView = StoredView;
|
|
21
|
+
StoredView.type = "STORED_VIEW";
|
|
22
|
+
function makeStoredView(appObj) {
|
|
23
|
+
return new StoredViewImp(appObj);
|
|
24
|
+
}
|
|
25
|
+
exports.makeStoredView = makeStoredView;
|
|
26
|
+
class StoredViewImp extends StoredView {
|
|
27
|
+
constructor(appObject) {
|
|
28
|
+
super(appObject, StoredView.type);
|
|
29
|
+
this._position = ValueObjects_1.Vector3.Zero();
|
|
30
|
+
this._rotation = ValueObjects_1.Quaternion.Identity();
|
|
31
|
+
this._memoizedScale = new Entities_1.MemoizedNumber(1, this.notifyOnChange);
|
|
32
|
+
this._memoizedHasStoredView = new Entities_1.MemoizedBoolean(false, this.notifyOnChange);
|
|
33
|
+
}
|
|
34
|
+
get position() {
|
|
35
|
+
return this._position;
|
|
36
|
+
}
|
|
37
|
+
set position(p) {
|
|
38
|
+
if (ValueObjects_1.Vector3.Equal(this._position, p))
|
|
39
|
+
return;
|
|
40
|
+
this._position = p;
|
|
41
|
+
this.notifyOnChange();
|
|
42
|
+
}
|
|
43
|
+
get rotation() {
|
|
44
|
+
return this._rotation;
|
|
45
|
+
}
|
|
46
|
+
set rotation(r) {
|
|
47
|
+
if (ValueObjects_1.Quaternion.Equal(this._rotation, r))
|
|
48
|
+
return;
|
|
49
|
+
this._rotation = r;
|
|
50
|
+
this.notifyOnChange();
|
|
51
|
+
}
|
|
52
|
+
get scale() {
|
|
53
|
+
return this._memoizedScale.val;
|
|
54
|
+
}
|
|
55
|
+
set scale(s) {
|
|
56
|
+
this._memoizedScale.val = s;
|
|
57
|
+
}
|
|
58
|
+
get hasStoredView() {
|
|
59
|
+
return this._memoizedHasStoredView.val;
|
|
60
|
+
}
|
|
61
|
+
set hasStoredView(hasStoredValue) {
|
|
62
|
+
this._memoizedHasStoredView.val = hasStoredValue;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AppObject } from "../../../AppObject/AppObject";
|
|
2
|
+
import { AppObjectUC } from "../../../AppObject/AppObjectUC";
|
|
3
|
+
import { SerializedSystem, StateMachine } from "../../../Entities";
|
|
4
|
+
export declare abstract class SerializeStoredView extends AppObjectUC implements SerializedSystem {
|
|
5
|
+
static readonly type = "SerializeStoredView";
|
|
6
|
+
name: string;
|
|
7
|
+
abstract seriliziationVersion: number;
|
|
8
|
+
abstract getSystemState(): object;
|
|
9
|
+
abstract applySystemState(state: object, version: number): void;
|
|
10
|
+
abstract applyDefaultState(transitionDuration: number): void;
|
|
11
|
+
}
|
|
12
|
+
export declare function makeSerializeStoredView(appObject: AppObject, stateMachine: StateMachine): SerializeStoredView;
|
|
13
|
+
export interface StoredViewDataV1 {
|
|
14
|
+
position: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
z: number;
|
|
18
|
+
};
|
|
19
|
+
rotation: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
z: number;
|
|
23
|
+
w: number;
|
|
24
|
+
};
|
|
25
|
+
scale: number;
|
|
26
|
+
hasStoredView: boolean;
|
|
27
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeSerializeStoredView = exports.SerializeStoredView = void 0;
|
|
4
|
+
const AppObjectUC_1 = require("../../../AppObject/AppObjectUC");
|
|
5
|
+
const ValueObjects_1 = require("../../../ValueObjects");
|
|
6
|
+
const StoredView_1 = require("../Entities/StoredView");
|
|
7
|
+
class SerializeStoredView extends AppObjectUC_1.AppObjectUC {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.name = "storedView";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.SerializeStoredView = SerializeStoredView;
|
|
14
|
+
SerializeStoredView.type = "SerializeStoredView";
|
|
15
|
+
function makeSerializeStoredView(appObject, stateMachine) {
|
|
16
|
+
return new SerializeStoredViewImp(appObject, stateMachine);
|
|
17
|
+
}
|
|
18
|
+
exports.makeSerializeStoredView = makeSerializeStoredView;
|
|
19
|
+
class SerializeStoredViewImp extends SerializeStoredView {
|
|
20
|
+
constructor(appObject, stateMachine) {
|
|
21
|
+
super(appObject, SerializeStoredView.type);
|
|
22
|
+
this.seriliziationVersion = 1;
|
|
23
|
+
this.storedView = appObject.getComponent(StoredView_1.StoredView.type);
|
|
24
|
+
if (!this.storedView) {
|
|
25
|
+
console.warn("SerializeStoredView UC has been added to an App Object that does not have a StoredView Entity. Add one before adding the UC");
|
|
26
|
+
this.dispose();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
stateMachine.registerSerializedSystem(this);
|
|
30
|
+
}
|
|
31
|
+
getSystemState() {
|
|
32
|
+
if (!this.storedView) {
|
|
33
|
+
console.warn("[SerializeStoredView] No stored view entity");
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
const data = {
|
|
37
|
+
position: this.storedView.position.dto,
|
|
38
|
+
rotation: this.storedView.rotation.dto,
|
|
39
|
+
scale: this.storedView.scale,
|
|
40
|
+
hasStoredView: this.storedView.hasStoredView,
|
|
41
|
+
};
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
applySystemState(serializedState, version) {
|
|
45
|
+
try {
|
|
46
|
+
if (version === 1) {
|
|
47
|
+
const castState = serializedState;
|
|
48
|
+
this.applyV1Data(castState);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
console.warn(`[SerializeStoredView] Unsupported version number ${version}. Defaulting`);
|
|
52
|
+
this.applyDefaultState();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
console.warn(`[SerializeStoredView] Caught when deserializing ${e}. Defaulting`);
|
|
57
|
+
this.applyDefaultState();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
applyDefaultState() {
|
|
61
|
+
if (!this.storedView) {
|
|
62
|
+
console.warn("[SerializeStoredView] No stored view entity");
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this.storedView.position = ValueObjects_1.Vector3.Zero();
|
|
66
|
+
this.storedView.rotation = ValueObjects_1.Quaternion.Identity();
|
|
67
|
+
this.storedView.scale = 1;
|
|
68
|
+
this.storedView.hasStoredView = false;
|
|
69
|
+
}
|
|
70
|
+
applyV1Data(data) {
|
|
71
|
+
if (!this.storedView) {
|
|
72
|
+
console.warn("[SerializeStoredView] No stored view entity");
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const pos = ValueObjects_1.Vector3.FromDTO(data.position);
|
|
76
|
+
const rot = ValueObjects_1.Quaternion.FromDTO(data.rotation);
|
|
77
|
+
this.storedView.position = pos;
|
|
78
|
+
this.storedView.rotation = rot;
|
|
79
|
+
this.storedView.scale = data.scale;
|
|
80
|
+
this.storedView.hasStoredView = data.hasStoredView;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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("./Entities/StoredView"), exports);
|
|
14
|
+
__exportStar(require("./UC/SerializeStoredView"), exports);
|
|
@@ -25,7 +25,15 @@ class StickTransform3D extends AppObjectUC_1.AppObjectUC {
|
|
|
25
25
|
get canBeStuck() {
|
|
26
26
|
if (!this.transform)
|
|
27
27
|
return false;
|
|
28
|
-
|
|
28
|
+
if (!ValueObjects_1.Vector3.Equal(this.transform.localPosition, ValueObjects_1.Vector3.Zero())) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
else if (!ValueObjects_1.Quaternion.Equal(this.transform.localRotation, ValueObjects_1.Quaternion.Identity())) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
29
37
|
}
|
|
30
38
|
stick(onCompleteCallback) {
|
|
31
39
|
var _a;
|
|
@@ -35,7 +43,7 @@ class StickTransform3D extends AppObjectUC_1.AppObjectUC {
|
|
|
35
43
|
}
|
|
36
44
|
return;
|
|
37
45
|
}
|
|
38
|
-
(_a = this.transform) === null || _a === void 0 ? void 0 : _a.lerp(this.stickDurationMS, this.easeFn, ValueObjects_1.Vector3.Zero(),
|
|
46
|
+
(_a = this.transform) === null || _a === void 0 ? void 0 : _a.lerp(this.stickDurationMS, this.easeFn, ValueObjects_1.Vector3.Zero(), ValueObjects_1.Quaternion.Identity(), undefined, onCompleteCallback);
|
|
39
47
|
}
|
|
40
48
|
static get(appObj) {
|
|
41
49
|
return appObj.getComponent(this.type);
|
|
@@ -36,10 +36,6 @@ export declare abstract class AppDispatcher {
|
|
|
36
36
|
abstract dispatch: (request: Request) => void;
|
|
37
37
|
abstract stateHasChanged: (state: object, assets: string[], validationErrorMessage?: string) => void;
|
|
38
38
|
abstract stateIsCompleted: () => void;
|
|
39
|
-
abstract goToPreviousState: () => void;
|
|
40
|
-
abstract goToNextState: () => void;
|
|
41
|
-
abstract hasPreviousState: () => Promise<boolean>;
|
|
42
|
-
abstract hasNextState: () => Promise<boolean>;
|
|
43
39
|
abstract getAppAssetsURL: () => Promise<string>;
|
|
44
40
|
abstract registerExternalStylesheets: (stylesheets: string[]) => void;
|
|
45
41
|
abstract appIsReady: () => void;
|
|
@@ -262,44 +262,6 @@ class AppDistpatcherImp extends AppDispatcher {
|
|
|
262
262
|
}
|
|
263
263
|
});
|
|
264
264
|
};
|
|
265
|
-
this.goToPreviousState = () => {
|
|
266
|
-
this.formRequestAndDispatch("GO_TO_PREVIOUS_STATE", 1);
|
|
267
|
-
};
|
|
268
|
-
this.goToNextState = () => {
|
|
269
|
-
this.formRequestAndDispatch("GO_TO_NEXT_STATE", 1);
|
|
270
|
-
};
|
|
271
|
-
this.hasNextState = () => {
|
|
272
|
-
return new Promise((resolve, reject) => {
|
|
273
|
-
const callback = (hasNextState) => {
|
|
274
|
-
resolve(hasNextState);
|
|
275
|
-
};
|
|
276
|
-
const payload = {
|
|
277
|
-
callback,
|
|
278
|
-
};
|
|
279
|
-
if (!this.hostHandler) {
|
|
280
|
-
reject(new Error("No host handler has been registered"));
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
this.formRequestAndDispatch("HAS_NEXT_STATE", 1, payload);
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
};
|
|
287
|
-
this.hasPreviousState = () => {
|
|
288
|
-
return new Promise((resolve, reject) => {
|
|
289
|
-
const callback = (hasPreviousState) => {
|
|
290
|
-
resolve(hasPreviousState);
|
|
291
|
-
};
|
|
292
|
-
const payload = {
|
|
293
|
-
callback,
|
|
294
|
-
};
|
|
295
|
-
if (!this.hostHandler) {
|
|
296
|
-
reject(new Error("No host handler has been registered"));
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
this.formRequestAndDispatch("HAS_PREVIOUS_STATE", 1, payload);
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
};
|
|
303
265
|
this.showAlert = (data) => {
|
|
304
266
|
const payload = {
|
|
305
267
|
title: data.title,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Vector3 } from "../ValueObjects";
|
|
2
|
+
export declare type OnFocusCameraChange = () => void;
|
|
3
|
+
export interface FocusCameraLerper {
|
|
4
|
+
cancelLerp: () => void;
|
|
5
|
+
}
|
|
6
|
+
export interface FocusCameraData {
|
|
7
|
+
defaultAlpha?: number;
|
|
8
|
+
defaultBeta?: number;
|
|
9
|
+
defaultRadius?: number;
|
|
10
|
+
defaultTarget?: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
z: number;
|
|
14
|
+
};
|
|
15
|
+
nearClip?: number;
|
|
16
|
+
farClip?: number;
|
|
17
|
+
alphaLimit?: {
|
|
18
|
+
min: number;
|
|
19
|
+
max: number;
|
|
20
|
+
};
|
|
21
|
+
betaLimit?: {
|
|
22
|
+
min: number;
|
|
23
|
+
max: number;
|
|
24
|
+
};
|
|
25
|
+
radiusLimit?: {
|
|
26
|
+
min: number;
|
|
27
|
+
max: number;
|
|
28
|
+
};
|
|
29
|
+
targetLimit?: {
|
|
30
|
+
min: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
z: number;
|
|
34
|
+
};
|
|
35
|
+
max: {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
z: number;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface FocusCamera {
|
|
43
|
+
alpha: number;
|
|
44
|
+
beta: number;
|
|
45
|
+
radius: number;
|
|
46
|
+
target: Vector3;
|
|
47
|
+
direction: Vector3;
|
|
48
|
+
cameraPosition: Vector3;
|
|
49
|
+
nearClip: number;
|
|
50
|
+
farClip: number;
|
|
51
|
+
defaultAlpha: number;
|
|
52
|
+
defaultBeta: number;
|
|
53
|
+
defaultRadius: number;
|
|
54
|
+
defaultTarget: Vector3;
|
|
55
|
+
setAlphaLimits: (min: number, max: number) => void;
|
|
56
|
+
clearAlphaLimits: () => void;
|
|
57
|
+
setBetaLimits: (min: number, max: number) => void;
|
|
58
|
+
clearBetaLimits: () => void;
|
|
59
|
+
setRadiusLimits: (min: number, max: number) => void;
|
|
60
|
+
clearRadiusLimits: () => void;
|
|
61
|
+
setTargetLimits: (min: Vector3, max: Vector3) => void;
|
|
62
|
+
clearTargetLimits: () => void;
|
|
63
|
+
registerLerp: (lerper: FocusCameraLerper) => void;
|
|
64
|
+
lerpCompleted: () => void;
|
|
65
|
+
cancelLerp: () => void;
|
|
66
|
+
applyData: (data: FocusCameraData) => void;
|
|
67
|
+
addObserver: (observer: OnFocusCameraChange) => void;
|
|
68
|
+
removeObserver: (observer: OnFocusCameraChange) => void;
|
|
69
|
+
}
|
|
70
|
+
export declare function makeFocusCamera(): FocusCamera;
|