@vived/app 2.29.0 → 2.29.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.
Files changed (145) hide show
  1. package/package.json +1 -1
  2. package/lib/Core/BaseApp/Boundary.d.ts +0 -49
  3. package/lib/Core/BaseApp/Boundary.js +0 -2
  4. package/lib/Core/BaseApp/Entity.d.ts +0 -11
  5. package/lib/Core/BaseApp/Entity.js +0 -2
  6. package/lib/Core/BaseApp/Errors/ErrorDuplicateSystemName.d.ts +0 -3
  7. package/lib/Core/BaseApp/Errors/ErrorDuplicateSystemName.js +0 -12
  8. package/lib/Core/BaseApp/Errors/ErrorNoHostHandler.d.ts +0 -3
  9. package/lib/Core/BaseApp/Errors/ErrorNoHostHandler.js +0 -10
  10. package/lib/Core/BaseApp/Errors/ErrorUnsupportedVersionNumber.d.ts +0 -3
  11. package/lib/Core/BaseApp/Errors/ErrorUnsupportedVersionNumber.js +0 -10
  12. package/lib/Core/BaseApp/Errors/index.d.ts +0 -3
  13. package/lib/Core/BaseApp/Errors/index.js +0 -15
  14. package/lib/Core/BaseApp/UseCase.d.ts +0 -43
  15. package/lib/Core/BaseApp/UseCase.js +0 -250
  16. package/lib/Core/BaseAppState/Boundary.d.ts +0 -14
  17. package/lib/Core/BaseAppState/Boundary.js +0 -2
  18. package/lib/Core/BaseAppState/Entity.d.ts +0 -5
  19. package/lib/Core/BaseAppState/Entity.js +0 -2
  20. package/lib/Core/BaseAppState/UseCase.d.ts +0 -16
  21. package/lib/Core/BaseAppState/UseCase.js +0 -54
  22. package/lib/Core/BaseAppState/UseCase_Imp.d.ts +0 -16
  23. package/lib/Core/BaseAppState/UseCase_Imp.js +0 -54
  24. package/lib/Core/DevicePreview/DevicePreviewUC_Imp.d.ts +0 -16
  25. package/lib/Core/DevicePreview/DevicePreviewUC_Imp.js +0 -56
  26. package/lib/Core/DevicePreview/boundary.d.ts +0 -14
  27. package/lib/Core/DevicePreview/boundary.js +0 -2
  28. package/lib/Core/DevicePreview/entity.d.ts +0 -5
  29. package/lib/Core/DevicePreview/entity.js +0 -2
  30. package/lib/Core/DispatchToHost/Entity.d.ts +0 -4
  31. package/lib/Core/DispatchToHost/Entity.js +0 -2
  32. package/lib/Core/DispatchToHost/UseCase.d.ts +0 -12
  33. package/lib/Core/DispatchToHost/UseCase.js +0 -70
  34. package/lib/Core/DispatchToHost/boundary.d.ts +0 -9
  35. package/lib/Core/DispatchToHost/boundary.js +0 -2
  36. package/lib/Core/Serilization/Boundary.d.ts +0 -20
  37. package/lib/Core/Serilization/Boundary.js +0 -2
  38. package/lib/Core/Serilization/Entity.d.ts +0 -3
  39. package/lib/Core/Serilization/Entity.js +0 -2
  40. package/lib/Core/Serilization/ErrorDuplicateSystemName.d.ts +0 -3
  41. package/lib/Core/Serilization/ErrorDuplicateSystemName.js +0 -12
  42. package/lib/Core/Serilization/ErrorUnsupportedVersionNumber.d.ts +0 -3
  43. package/lib/Core/Serilization/ErrorUnsupportedVersionNumber.js +0 -10
  44. package/lib/Core/Serilization/Errors.d.ts +0 -6
  45. package/lib/Core/Serilization/Errors.js +0 -19
  46. package/lib/Core/Serilization/UseCase.d.ts +0 -10
  47. package/lib/Core/Serilization/UseCase.js +0 -52
  48. package/lib/Core/Serilization/UseCase_Imp.d.ts +0 -10
  49. package/lib/Core/Serilization/UseCase_Imp.js +0 -51
  50. package/lib/Core/index.d.ts +0 -3
  51. package/lib/Core/index.js +0 -19
  52. package/lib/Entities/Color.d.ts +0 -20
  53. package/lib/Entities/Color.js +0 -59
  54. package/lib/Entities/FocusCamera.d.ts +0 -70
  55. package/lib/Entities/FocusCamera.js +0 -272
  56. package/lib/Entities/LineSegment2D.d.ts +0 -11
  57. package/lib/Entities/LineSegment2D.js +0 -70
  58. package/lib/Entities/MouseSceneInput.d.ts +0 -15
  59. package/lib/Entities/MouseSceneInput.js +0 -109
  60. package/lib/Entities/OrbitCamera.d.ts +0 -76
  61. package/lib/Entities/OrbitCamera.js +0 -243
  62. package/lib/Entities/ParametricLine.d.ts +0 -29
  63. package/lib/Entities/ParametricLine.js +0 -79
  64. package/lib/Entities/ParametricPlane.d.ts +0 -20
  65. package/lib/Entities/ParametricPlane.js +0 -63
  66. package/lib/Entities/Vector2.d.ts +0 -21
  67. package/lib/Entities/Vector2.js +0 -83
  68. package/lib/Entities/Vector3.d.ts +0 -19
  69. package/lib/Entities/Vector3.js +0 -75
  70. package/lib/Interface/Controllers/appHandler.d.ts +0 -12
  71. package/lib/Interface/Controllers/appHandler.js +0 -94
  72. package/lib/Interface/Controllers/defaultAppHanlderFunctions.d.ts +0 -3
  73. package/lib/Interface/Controllers/defaultAppHanlderFunctions.js +0 -31
  74. package/lib/Interface/Controllers/dispatchStateChange.d.ts +0 -2
  75. package/lib/Interface/Controllers/dispatchStateChange.js +0 -10
  76. package/lib/Interface/Controllers/index.d.ts +0 -9
  77. package/lib/Interface/Controllers/index.js +0 -21
  78. package/lib/Interface/Controllers/makeAppHandler.d.ts +0 -12
  79. package/lib/Interface/Controllers/makeAppHandler.js +0 -96
  80. package/lib/Interface/Controllers/setDevicePreview.d.ts +0 -2
  81. package/lib/Interface/Controllers/setDevicePreview.js +0 -14
  82. package/lib/Interface/Controllers/setIsAuthoring.d.ts +0 -2
  83. package/lib/Interface/Controllers/setIsAuthoring.js +0 -14
  84. package/lib/Interface/Controllers/setState.d.ts +0 -2
  85. package/lib/Interface/Controllers/setState.js +0 -21
  86. package/lib/Interface/Controllers/showBabylonInspector.d.ts +0 -2
  87. package/lib/Interface/Controllers/showBabylonInspector.js +0 -9
  88. package/lib/Interface/Controllers/startApp.d.ts +0 -1
  89. package/lib/Interface/Controllers/startApp.js +0 -9
  90. package/lib/Interface/Controllers/stopApp.d.ts +0 -2
  91. package/lib/Interface/Controllers/stopApp.js +0 -10
  92. package/lib/Interface/PresentationManagers/DevicePreviewPM.d.ts +0 -13
  93. package/lib/Interface/PresentationManagers/DevicePreviewPM.js +0 -25
  94. package/lib/Interface/PresentationManagers/IsAuthoringPM.d.ts +0 -10
  95. package/lib/Interface/PresentationManagers/IsAuthoringPM.js +0 -23
  96. package/lib/Interface/PresentationManagers/ShowBabylonInspectorPM.d.ts +0 -10
  97. package/lib/Interface/PresentationManagers/ShowBabylonInspectorPM.js +0 -23
  98. package/lib/Interface/PresentationManagers/index.d.ts +0 -3
  99. package/lib/Interface/PresentationManagers/index.js +0 -15
  100. package/lib/Interface/appHandler.d.ts +0 -12
  101. package/lib/Interface/appHandler.js +0 -94
  102. package/lib/Interface/index.d.ts +0 -2
  103. package/lib/Interface/index.js +0 -14
  104. package/lib/PresentationManagers/FocusCameraPM.d.ts +0 -15
  105. package/lib/PresentationManagers/FocusCameraPM.js +0 -31
  106. package/lib/PresentationManagers/FocusCameraPosRotPM.d.ts +0 -13
  107. package/lib/PresentationManagers/FocusCameraPosRotPM.js +0 -28
  108. package/lib/PresentationManagers/HoverLabelPM.d.ts +0 -17
  109. package/lib/PresentationManagers/HoverLabelPM.js +0 -32
  110. package/lib/PresentationManagers/OrbitCameraPM.d.ts +0 -14
  111. package/lib/PresentationManagers/OrbitCameraPM.js +0 -31
  112. package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.d.ts +0 -17
  113. package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.js +0 -64
  114. package/lib/UseCases/FocusCamera/LerpFocusCamera.d.ts +0 -36
  115. package/lib/UseCases/FocusCamera/LerpFocusCamera.js +0 -71
  116. package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.d.ts +0 -11
  117. package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.js +0 -36
  118. package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.d.ts +0 -11
  119. package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.js +0 -36
  120. package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.d.ts +0 -11
  121. package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.js +0 -26
  122. package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.d.ts +0 -11
  123. package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.js +0 -33
  124. package/lib/UseCases/FocusCamera/SerializeFocusCamera.d.ts +0 -22
  125. package/lib/UseCases/FocusCamera/SerializeFocusCamera.js +0 -81
  126. package/lib/UseCases/FocusCamera/index.d.ts +0 -7
  127. package/lib/UseCases/FocusCamera/index.js +0 -19
  128. package/lib/UseCases/LerpOrbitCamera.d.ts +0 -36
  129. package/lib/UseCases/LerpOrbitCamera.js +0 -71
  130. package/lib/UseCases/OrbitCamera/LerpOrbitCamera.d.ts +0 -36
  131. package/lib/UseCases/OrbitCamera/LerpOrbitCamera.js +0 -71
  132. package/lib/UseCases/OrbitCamera/PixelDolly_OrbitCamera.d.ts +0 -9
  133. package/lib/UseCases/OrbitCamera/PixelDolly_OrbitCamera.js +0 -31
  134. package/lib/UseCases/OrbitCamera/PixelPlanePan_OrbitCamera.d.ts +0 -10
  135. package/lib/UseCases/OrbitCamera/PixelPlanePan_OrbitCamera.js +0 -31
  136. package/lib/UseCases/OrbitCamera/SerializeOrbitCamera.d.ts +0 -22
  137. package/lib/UseCases/OrbitCamera/SerializeOrbitCamera.js +0 -81
  138. package/lib/UseCases/OrbitCamera/index.d.ts +0 -4
  139. package/lib/UseCases/OrbitCamera/index.js +0 -16
  140. package/lib/UseCases/SerializeCamera.d.ts +0 -21
  141. package/lib/UseCases/SerializeCamera.js +0 -59
  142. package/lib/UseCases/SerializeOrbitCamera.d.ts +0 -21
  143. package/lib/UseCases/SerializeOrbitCamera.js +0 -59
  144. package/lib/UseCases/SerializedCamDemo.d.ts +0 -0
  145. package/lib/UseCases/SerializedCamDemo.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vived/app",
3
- "version": "2.29.0",
3
+ "version": "2.29.1",
4
4
  "description": "Public package for the VIVED Learning App system",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,49 +0,0 @@
1
- import { Handler } from "@vived/app-host-boundary";
2
- export interface BaseAppUC {
3
- getIsAuthoring(): boolean;
4
- setIsAuthoring(isAuthoring: boolean): void;
5
- getShowBabylonInspector(): boolean;
6
- setShowBabylonInspector(showInspector: boolean): void;
7
- addObserver(observer: BaseAppStateObserver): void;
8
- removeObserver(observer: BaseAppStateObserver): void;
9
- setVerbose(verbose: boolean): void;
10
- getSerializedState(): SerializedStates;
11
- setSerializedState(state: SerializedStates, transitionTime: number): void;
12
- setDefaultState(transitionTime: number): void;
13
- registerSerializableSystem(serializedSystem: SerializableSystem): void;
14
- getIsTransitioning(): boolean;
15
- abortTransition(): void;
16
- setTransitionEaseFn: (easeFn: (normalizedTime: number) => number) => void;
17
- setHostHandler(handler: Handler): void;
18
- hasHostHandler(): boolean;
19
- dispatchOnStateChange(stateObject: object): void;
20
- dispatchOnStateComplete(): void;
21
- dispatchSubmitResults(results: object): void;
22
- dispatchGetAppAssetsURL(): string;
23
- setDevicePreview(x: number, y: number): void;
24
- clearDevicePreview(): void;
25
- getUseDevicePreview(): boolean;
26
- getDevicePreviewSize(): {
27
- x: number;
28
- y: number;
29
- };
30
- }
31
- export interface BaseAppStateObserver {
32
- onBaseAppChange: () => void;
33
- }
34
- export interface SerializedStates {
35
- version: number;
36
- systems: SystemState[];
37
- }
38
- export interface SystemState {
39
- name: string;
40
- seriliziationVersion: number;
41
- state: object;
42
- }
43
- export interface SerializableSystem {
44
- name: string;
45
- seriliziationVersion: number;
46
- getSerializedObject(): object;
47
- intializeStateForTransition(serializedState: object | null, version: number): void;
48
- applyTransition(percent: number): void;
49
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
1
- export interface BaseAppState {
2
- isAuthoring: boolean;
3
- showBabyonInspector: boolean;
4
- handler?: unknown;
5
- appAssetsURL?: string;
6
- useDevicePreview: boolean;
7
- x: number;
8
- y: number;
9
- isTransitioning: boolean;
10
- verbose: boolean;
11
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export declare class DuplicateSystemNameError extends Error {
2
- constructor(name: string);
3
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DuplicateSystemNameError = void 0;
4
- class DuplicateSystemNameError extends Error {
5
- constructor(name) {
6
- const msg = "Cannot add two serialized systems named " +
7
- name +
8
- ". Every system name must be unique";
9
- super(msg);
10
- }
11
- }
12
- exports.DuplicateSystemNameError = DuplicateSystemNameError;
@@ -1,3 +0,0 @@
1
- export declare class ErrorNoHostHandler extends Error {
2
- constructor();
3
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ErrorNoHostHandler = void 0;
4
- class ErrorNoHostHandler extends Error {
5
- constructor() {
6
- const msg = "Host Handler has not been set";
7
- super(msg);
8
- }
9
- }
10
- exports.ErrorNoHostHandler = ErrorNoHostHandler;
@@ -1,3 +0,0 @@
1
- export declare class UnsupportedVersionNumber extends Error {
2
- constructor(version: number);
3
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnsupportedVersionNumber = void 0;
4
- class UnsupportedVersionNumber extends Error {
5
- constructor(version) {
6
- const msg = "Serialization version " + version + " is not supported";
7
- super(msg);
8
- }
9
- }
10
- exports.UnsupportedVersionNumber = UnsupportedVersionNumber;
@@ -1,3 +0,0 @@
1
- export * from "./ErrorDuplicateSystemName";
2
- export * from "./ErrorUnsupportedVersionNumber";
3
- export * from "./ErrorNoHostHandler";
@@ -1,15 +0,0 @@
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("./ErrorDuplicateSystemName"), exports);
14
- __exportStar(require("./ErrorUnsupportedVersionNumber"), exports);
15
- __exportStar(require("./ErrorNoHostHandler"), exports);
@@ -1,43 +0,0 @@
1
- import { Handler } from "@vived/app-host-boundary";
2
- import { BaseAppStateObserver, BaseAppUC, SerializableSystem, SerializedStates } from "./Boundary";
3
- export declare class BaseAppUCImp implements BaseAppUC {
4
- private appState;
5
- private observers;
6
- private systems;
7
- private serilizationVersion;
8
- private currentInterval?;
9
- private easeFunction;
10
- constructor();
11
- setVerbose(verbose: boolean): void;
12
- abortTransition: () => void;
13
- setTransitionEaseFn: (easeFn: (normalizedTime: number) => number) => void;
14
- getIsTransitioning: () => boolean;
15
- setDevicePreview: (x: number, y: number) => void;
16
- clearDevicePreview: () => void;
17
- getUseDevicePreview: () => boolean;
18
- getDevicePreviewSize: () => {
19
- x: number;
20
- y: number;
21
- };
22
- setHostHandler: (handler: Handler) => void;
23
- hasHostHandler: () => boolean;
24
- dispatchOnStateChange: (stateObject: object) => void;
25
- dispatchOnStateComplete: () => void;
26
- dispatchSubmitResults: (results: object) => void;
27
- dispatchGetAppAssetsURL: () => string;
28
- registerSerializableSystem: (serializedSystem: SerializableSystem) => void;
29
- getSerializedState: () => SerializedStates;
30
- setSerializedState: (state: SerializedStates, duration: number) => void;
31
- setDefaultState: (duration: number) => void;
32
- getShowBabylonInspector: () => boolean;
33
- setShowBabylonInspector: (showInspector: boolean) => void;
34
- getIsAuthoring: () => boolean;
35
- setIsAuthoring: (isAuthoring: boolean) => void;
36
- addObserver: (observer: BaseAppStateObserver) => void;
37
- removeObserver: (observer: BaseAppStateObserver) => void;
38
- private logToConsole;
39
- private startTransition;
40
- private applyTransitionToSystems;
41
- private notify;
42
- private dispatch;
43
- }
@@ -1,250 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseAppUCImp = void 0;
4
- const app_host_boundary_1 = require("@vived/app-host-boundary");
5
- const Errors_1 = require("./Errors");
6
- class BaseAppUCImp {
7
- constructor() {
8
- this.observers = [];
9
- this.systems = new Map();
10
- this.serilizationVersion = 2;
11
- this.easeFunction = (normalizedTime) => {
12
- return normalizedTime; // default to a linear function
13
- };
14
- this.abortTransition = () => {
15
- if (this.currentInterval) {
16
- clearInterval(this.currentInterval);
17
- }
18
- this.appState.isTransitioning = false;
19
- };
20
- this.setTransitionEaseFn = (easeFn) => {
21
- this.easeFunction = easeFn;
22
- };
23
- this.getIsTransitioning = () => {
24
- return this.appState.isTransitioning;
25
- };
26
- this.setDevicePreview = (x, y) => {
27
- if (this.appState.useDevicePreview &&
28
- x === this.appState.x &&
29
- y === this.appState.y) {
30
- return;
31
- }
32
- this.appState.useDevicePreview = true;
33
- this.appState.x = x;
34
- this.appState.y = y;
35
- this.notify();
36
- this.logToConsole(`Device Preview set to ${x}, ${y}`);
37
- };
38
- this.clearDevicePreview = () => {
39
- if (!this.appState.useDevicePreview)
40
- return;
41
- this.appState.useDevicePreview = false;
42
- this.appState.x = -1;
43
- this.appState.y = -1;
44
- this.notify();
45
- this.logToConsole(`Device Preview cleared`);
46
- };
47
- this.getUseDevicePreview = () => {
48
- return this.appState.useDevicePreview;
49
- };
50
- this.getDevicePreviewSize = () => {
51
- const { x, y } = this.appState;
52
- return { x, y };
53
- };
54
- this.setHostHandler = (handler) => {
55
- this.appState.handler = handler;
56
- this.logToConsole("Handler set");
57
- };
58
- this.hasHostHandler = () => {
59
- if (this.appState.handler) {
60
- return true;
61
- }
62
- else {
63
- return false;
64
- }
65
- };
66
- this.dispatchOnStateChange = (stateObject) => {
67
- const request = {
68
- type: app_host_boundary_1.ON_STATE_CHANGE,
69
- version: 1,
70
- payload: {
71
- stateObject,
72
- },
73
- };
74
- this.dispatch(request);
75
- };
76
- this.dispatchOnStateComplete = () => {
77
- const request = {
78
- type: app_host_boundary_1.ON_STATE_COMPLETED,
79
- version: 1,
80
- };
81
- this.dispatch(request);
82
- };
83
- this.dispatchSubmitResults = (results) => {
84
- const request = {
85
- type: app_host_boundary_1.SUBMIT_RESULTS,
86
- version: 1,
87
- payload: {
88
- results,
89
- },
90
- };
91
- this.dispatch(request);
92
- };
93
- this.dispatchGetAppAssetsURL = () => {
94
- var _a;
95
- const callback = (url) => {
96
- this.appState.appAssetsURL = url;
97
- };
98
- const request = {
99
- type: app_host_boundary_1.GET_APP_ASSET_URL,
100
- version: 1,
101
- payload: {
102
- callback,
103
- },
104
- };
105
- this.dispatch(request);
106
- return (_a = this.appState.appAssetsURL) !== null && _a !== void 0 ? _a : "";
107
- };
108
- this.registerSerializableSystem = (serializedSystem) => {
109
- if (this.systems.has(serializedSystem.name)) {
110
- throw new Errors_1.DuplicateSystemNameError(serializedSystem.name);
111
- }
112
- this.systems.set(serializedSystem.name, serializedSystem);
113
- };
114
- this.getSerializedState = () => {
115
- const systems = Array.from(this.systems.values());
116
- const serializedStates = systems.map((system) => {
117
- const state = system.getSerializedObject();
118
- return {
119
- seriliziationVersion: system.seriliziationVersion,
120
- name: system.name,
121
- state,
122
- };
123
- });
124
- return {
125
- version: this.serilizationVersion,
126
- systems: serializedStates,
127
- };
128
- };
129
- this.setSerializedState = (state, duration) => {
130
- if (state.version === 2) {
131
- state.systems.forEach((systemState) => {
132
- const seriliazableSystem = this.systems.get(systemState.name);
133
- if (seriliazableSystem) {
134
- seriliazableSystem.intializeStateForTransition(systemState.state, systemState.seriliziationVersion);
135
- }
136
- else {
137
- console.warn("Unable to find seriarializedSystem " + systemState.name);
138
- }
139
- });
140
- }
141
- // Here is where we will add support for future versions
142
- else {
143
- throw new Errors_1.UnsupportedVersionNumber(state.version);
144
- }
145
- this.startTransition(duration);
146
- this.logToConsole(`State set to ${JSON.stringify(state)} with a ${duration} second duration`);
147
- };
148
- this.setDefaultState = (duration) => {
149
- this.systems.forEach((system) => {
150
- system.intializeStateForTransition(null, -1);
151
- });
152
- this.startTransition(duration);
153
- this.logToConsole(`State has been set to transition to default over ${duration} seconds`);
154
- };
155
- this.getShowBabylonInspector = () => {
156
- return this.appState.showBabyonInspector;
157
- };
158
- this.setShowBabylonInspector = (showInspector) => {
159
- if (this.appState.showBabyonInspector === showInspector)
160
- return;
161
- this.appState.showBabyonInspector = showInspector;
162
- this.notify();
163
- this.logToConsole(`Show Babylon Inspector set to ${showInspector}`);
164
- };
165
- this.getIsAuthoring = () => {
166
- return this.appState.isAuthoring;
167
- };
168
- this.setIsAuthoring = (isAuthoring) => {
169
- if (isAuthoring === this.appState.isAuthoring)
170
- return;
171
- this.appState.isAuthoring = isAuthoring;
172
- this.notify();
173
- this.logToConsole(`Is Authoring set to ${isAuthoring}`);
174
- };
175
- this.addObserver = (observer) => {
176
- this.observers.push(observer);
177
- };
178
- this.removeObserver = (observer) => {
179
- const index = this.observers.indexOf(observer);
180
- if (index >= 0) {
181
- this.observers.splice(index, 1);
182
- }
183
- };
184
- this.appState = {
185
- isAuthoring: false,
186
- showBabyonInspector: false,
187
- useDevicePreview: false,
188
- x: -1,
189
- y: -1,
190
- isTransitioning: false,
191
- verbose: false,
192
- };
193
- }
194
- setVerbose(verbose) {
195
- this.appState.verbose = verbose;
196
- }
197
- logToConsole(message) {
198
- if (!this.appState.verbose)
199
- return;
200
- console.log("[Base App UC] " + message);
201
- }
202
- startTransition(duration) {
203
- if (duration === 0) {
204
- if (this.currentInterval) {
205
- clearInterval(this.currentInterval);
206
- this.appState.isTransitioning = false;
207
- }
208
- this.applyTransitionToSystems(1);
209
- }
210
- else {
211
- if (this.currentInterval) {
212
- clearInterval(this.currentInterval);
213
- }
214
- this.appState.isTransitioning = true;
215
- const durationInMS = duration * 1000;
216
- let chrono = 0;
217
- const transitionDelta = 10;
218
- this.currentInterval = setInterval(() => {
219
- chrono = chrono + transitionDelta;
220
- let normalizedTime = chrono / durationInMS;
221
- if (normalizedTime > 1) {
222
- normalizedTime = 1;
223
- }
224
- const percent = this.easeFunction(normalizedTime);
225
- this.applyTransitionToSystems(percent);
226
- if (normalizedTime >= 1 && this.currentInterval) {
227
- clearInterval(this.currentInterval);
228
- this.appState.isTransitioning = false;
229
- }
230
- }, transitionDelta);
231
- }
232
- }
233
- applyTransitionToSystems(percent) {
234
- this.systems.forEach((system) => {
235
- system.applyTransition(percent);
236
- });
237
- }
238
- notify() {
239
- this.observers.forEach((observer) => observer.onBaseAppChange());
240
- }
241
- dispatch(request) {
242
- if (!this.appState.handler) {
243
- throw new Errors_1.ErrorNoHostHandler();
244
- }
245
- const handler = this.appState.handler;
246
- handler(request);
247
- this.logToConsole(`Dispatched request: ${JSON.stringify(request)}`);
248
- }
249
- }
250
- exports.BaseAppUCImp = BaseAppUCImp;
@@ -1,14 +0,0 @@
1
- export interface BaseAppStateUC {
2
- getIsAuthoring(): boolean;
3
- setIsAuthoring(isAuthoring: boolean): void;
4
- getShowBabylonInspector(): boolean;
5
- setShowBabylonInspector(showInspector: boolean): void;
6
- getAppContainer(): HTMLElement | undefined;
7
- setAppContainer(container: HTMLElement): void;
8
- clearAppContainer(): void;
9
- addObserver(observer: BaseAppStateObserver): void;
10
- removeObserver(observer: BaseAppStateObserver): void;
11
- }
12
- export interface BaseAppStateObserver {
13
- onAppStateChange: () => void;
14
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export interface BaseAppState {
2
- isAuthoring: boolean;
3
- showBabyonInspector: boolean;
4
- appContainer?: HTMLElement;
5
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,16 +0,0 @@
1
- import { BaseAppStateObserver, BaseAppStateUC } from "./Boundary";
2
- export declare class BaseAppStateUCImp implements BaseAppStateUC {
3
- private appState;
4
- private observers;
5
- constructor();
6
- getAppContainer(): HTMLElement | undefined;
7
- setAppContainer(container: HTMLElement): void;
8
- clearAppContainer(): void;
9
- getShowBabylonInspector(): boolean;
10
- setShowBabylonInspector(showInspector: boolean): void;
11
- getIsAuthoring(): boolean;
12
- setIsAuthoring(isAuthoring: boolean): void;
13
- addObserver(observer: BaseAppStateObserver): void;
14
- removeObserver(observer: BaseAppStateObserver): void;
15
- private notify;
16
- }
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseAppStateUCImp = void 0;
4
- class BaseAppStateUCImp {
5
- constructor() {
6
- this.observers = [];
7
- this.appState = {
8
- isAuthoring: false,
9
- showBabyonInspector: false,
10
- };
11
- }
12
- getAppContainer() {
13
- return this.appState.appContainer;
14
- }
15
- setAppContainer(container) {
16
- this.appState.appContainer = container;
17
- this.notify();
18
- }
19
- clearAppContainer() {
20
- this.appState.appContainer = undefined;
21
- this.notify();
22
- }
23
- getShowBabylonInspector() {
24
- return this.appState.showBabyonInspector;
25
- }
26
- setShowBabylonInspector(showInspector) {
27
- if (this.appState.showBabyonInspector === showInspector)
28
- return;
29
- this.appState.showBabyonInspector = showInspector;
30
- this.notify();
31
- }
32
- getIsAuthoring() {
33
- return this.appState.isAuthoring;
34
- }
35
- setIsAuthoring(isAuthoring) {
36
- if (isAuthoring === this.appState.isAuthoring)
37
- return;
38
- this.appState.isAuthoring = isAuthoring;
39
- this.notify();
40
- }
41
- addObserver(observer) {
42
- this.observers.push(observer);
43
- }
44
- removeObserver(observer) {
45
- const index = this.observers.indexOf(observer);
46
- if (index >= 0) {
47
- this.observers.splice(index, 1);
48
- }
49
- }
50
- notify() {
51
- this.observers.forEach((observer) => observer.onAppStateChange());
52
- }
53
- }
54
- exports.BaseAppStateUCImp = BaseAppStateUCImp;
@@ -1,16 +0,0 @@
1
- import { BaseAppStateObserver, BaseAppStateUC } from "./Boundary";
2
- export declare class BaseAppStateUC_Imp implements BaseAppStateUC {
3
- private appState;
4
- private observers;
5
- constructor();
6
- getAppContainer(): HTMLElement | undefined;
7
- setAppContainer(container: HTMLElement): void;
8
- clearAppContainer(): void;
9
- getShowBabylonInspector(): boolean;
10
- setShowBabylonInspector(showInspector: boolean): void;
11
- getIsAuthoring(): boolean;
12
- setIsAuthoring(isAuthoring: boolean): void;
13
- addObserver(observer: BaseAppStateObserver): void;
14
- removeObserver(observer: BaseAppStateObserver): void;
15
- private notify;
16
- }
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseAppStateUC_Imp = void 0;
4
- class BaseAppStateUC_Imp {
5
- constructor() {
6
- this.observers = [];
7
- this.appState = {
8
- isAuthoring: false,
9
- showBabyonInspector: false,
10
- };
11
- }
12
- getAppContainer() {
13
- return this.appState.appContainer;
14
- }
15
- setAppContainer(container) {
16
- this.appState.appContainer = container;
17
- this.notify();
18
- }
19
- clearAppContainer() {
20
- this.appState.appContainer = undefined;
21
- this.notify();
22
- }
23
- getShowBabylonInspector() {
24
- return this.appState.showBabyonInspector;
25
- }
26
- setShowBabylonInspector(showInspector) {
27
- if (this.appState.showBabyonInspector === showInspector)
28
- return;
29
- this.appState.showBabyonInspector = showInspector;
30
- this.notify();
31
- }
32
- getIsAuthoring() {
33
- return this.appState.isAuthoring;
34
- }
35
- setIsAuthoring(isAuthoring) {
36
- if (isAuthoring === this.appState.isAuthoring)
37
- return;
38
- this.appState.isAuthoring = isAuthoring;
39
- this.notify();
40
- }
41
- addObserver(observer) {
42
- this.observers.push(observer);
43
- }
44
- removeObserver(observer) {
45
- const index = this.observers.indexOf(observer);
46
- if (index >= 0) {
47
- this.observers.splice(index, 1);
48
- }
49
- }
50
- notify() {
51
- this.observers.forEach((observer) => observer.onAppStateChange());
52
- }
53
- }
54
- exports.BaseAppStateUC_Imp = BaseAppStateUC_Imp;
@@ -1,16 +0,0 @@
1
- import { DevicePreviewUC, OnDevicePreviewChange } from "./boundary";
2
- export declare class DevicePreviewUCImp implements DevicePreviewUC {
3
- private observers;
4
- private entity;
5
- constructor();
6
- setDevicePreview(x: number, y: number): void;
7
- clearDevicePreview(): void;
8
- getUseDevicePreview(): boolean;
9
- getDevicePreviewSize(): {
10
- x: number;
11
- y: number;
12
- };
13
- addObserver(observer: OnDevicePreviewChange): void;
14
- removeObserver(observer: OnDevicePreviewChange): void;
15
- private notify;
16
- }