@vived/app 4.24.0 → 4.26.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.
Files changed (184) hide show
  1. package/lib/Components/App/Controller/index.d.ts +1 -0
  2. package/lib/Components/App/Controller/index.js +1 -0
  3. package/lib/Components/App/Controller/updateContentSize.d.ts +2 -0
  4. package/lib/Components/App/Controller/updateContentSize.js +13 -0
  5. package/lib/Components/App/Entity/BaseAppState.d.ts +2 -0
  6. package/lib/Components/App/Entity/BaseAppState.js +7 -0
  7. package/lib/Components/App/Mocks/MockUpdateContentSizeUC.d.ts +9 -0
  8. package/lib/Components/App/Mocks/MockUpdateContentSizeUC.js +15 -0
  9. package/lib/Components/App/Mocks/index.d.ts +1 -0
  10. package/lib/Components/App/Mocks/index.js +1 -0
  11. package/lib/Components/App/UC/SerializeBaseAppState.d.ts +17 -0
  12. package/lib/Components/App/UC/SerializeBaseAppState.js +59 -0
  13. package/lib/Components/App/UC/UpdateContentSizeUC.d.ts +7 -0
  14. package/lib/Components/App/UC/UpdateContentSizeUC.js +33 -0
  15. package/lib/Components/App/UC/index.d.ts +2 -0
  16. package/lib/Components/App/UC/index.js +2 -0
  17. package/lib/Components/Challenge/Adapters/challengeAuthorHelpHookAdapter.d.ts +3 -0
  18. package/lib/Components/Challenge/Adapters/challengeAuthorHelpHookAdapter.js +23 -0
  19. package/lib/Components/Challenge/Adapters/challengeConsumerHelpHookAdapter.d.ts +3 -0
  20. package/lib/Components/Challenge/Adapters/challengeConsumerHelpHookAdapter.js +23 -0
  21. package/lib/Components/Challenge/Adapters/index.d.ts +3 -0
  22. package/lib/Components/Challenge/Adapters/index.js +15 -0
  23. package/lib/Components/Challenge/Adapters/selectedChallengeHookAdapter.d.ts +3 -0
  24. package/lib/Components/Challenge/Adapters/selectedChallengeHookAdapter.js +29 -0
  25. package/lib/Components/Challenge/Controller/clickTryChallengeAgain.d.ts +2 -0
  26. package/lib/Components/Challenge/Controller/clickTryChallengeAgain.js +13 -0
  27. package/lib/Components/Challenge/Controller/index.d.ts +1 -0
  28. package/lib/Components/Challenge/Controller/index.js +1 -0
  29. package/lib/Components/Challenge/Mocks/TryChallengeAgainUcMock.d.ts +8 -0
  30. package/lib/Components/Challenge/Mocks/TryChallengeAgainUcMock.js +15 -0
  31. package/lib/Components/Challenge/Mocks/index.d.ts +1 -0
  32. package/lib/Components/Challenge/Mocks/index.js +1 -0
  33. package/lib/Components/Challenge/UCs/TryChallengeAgainUC.d.ts +6 -0
  34. package/lib/Components/Challenge/UCs/TryChallengeAgainUC.js +11 -0
  35. package/lib/Components/Challenge/UCs/index.d.ts +1 -0
  36. package/lib/Components/Challenge/UCs/index.js +1 -0
  37. package/lib/Components/Challenge/index.d.ts +1 -1
  38. package/lib/Components/Challenge/index.js +1 -1
  39. package/lib/Components/ChannelModel/Adapters/index.d.ts +1 -0
  40. package/lib/Components/ChannelModel/Adapters/index.js +1 -0
  41. package/lib/Components/ChannelModel/Adapters/modelHasLandmarksAdapter.d.ts +2 -0
  42. package/lib/Components/ChannelModel/Adapters/modelHasLandmarksAdapter.js +27 -0
  43. package/lib/Components/ChannelModel/Mocks/ModelHasLandmarksPmMock.d.ts +7 -0
  44. package/lib/Components/ChannelModel/Mocks/ModelHasLandmarksPmMock.js +11 -0
  45. package/lib/Components/ChannelModel/Mocks/index.d.ts +1 -0
  46. package/lib/Components/ChannelModel/Mocks/index.js +1 -0
  47. package/lib/Components/ChannelModel/PMs/ModelHasLandmarksPM.d.ts +6 -0
  48. package/lib/Components/ChannelModel/PMs/ModelHasLandmarksPM.js +56 -0
  49. package/lib/Components/ChannelModel/PMs/index.d.ts +1 -0
  50. package/lib/Components/ChannelModel/PMs/index.js +1 -0
  51. package/lib/Components/FramedScreen/Adapters/framedContainerAdapter.d.ts +3 -0
  52. package/lib/Components/FramedScreen/Adapters/framedContainerAdapter.js +23 -0
  53. package/lib/Components/FramedScreen/Adapters/framedScreenSizeAdapter.d.ts +3 -0
  54. package/lib/Components/FramedScreen/Adapters/framedScreenSizeAdapter.js +23 -0
  55. package/lib/Components/FramedScreen/Adapters/index.d.ts +2 -0
  56. package/lib/Components/FramedScreen/Adapters/index.js +14 -0
  57. package/lib/Components/FramedScreen/Mocks/FramedContainerPmMock.d.ts +7 -0
  58. package/lib/Components/FramedScreen/Mocks/FramedContainerPmMock.js +11 -0
  59. package/lib/Components/FramedScreen/Mocks/FramedScreenSizePmMock.d.ts +8 -0
  60. package/lib/Components/FramedScreen/Mocks/FramedScreenSizePmMock.js +15 -0
  61. package/lib/Components/FramedScreen/Mocks/index.d.ts +2 -0
  62. package/lib/Components/FramedScreen/Mocks/index.js +14 -0
  63. package/lib/Components/FramedScreen/PM/FramedContainerPM.d.ts +16 -0
  64. package/lib/Components/FramedScreen/PM/FramedContainerPM.js +66 -0
  65. package/lib/Components/FramedScreen/PM/FramedScreenSizePM.d.ts +2 -6
  66. package/lib/Components/FramedScreen/PM/FramedScreenSizePM.js +16 -14
  67. package/lib/Components/FramedScreen/PM/index.d.ts +1 -1
  68. package/lib/Components/FramedScreen/PM/index.js +1 -1
  69. package/lib/Components/FramedScreen/index.d.ts +2 -0
  70. package/lib/Components/FramedScreen/index.js +2 -0
  71. package/lib/Components/Landmarks/Adapters/index.d.ts +2 -0
  72. package/lib/Components/Landmarks/Adapters/index.js +14 -0
  73. package/lib/Components/Landmarks/Adapters/landmarkListAdapter.d.ts +2 -0
  74. package/lib/Components/Landmarks/Adapters/landmarkListAdapter.js +25 -0
  75. package/lib/Components/Landmarks/Adapters/landmarkSizeAdapter.d.ts +2 -0
  76. package/lib/Components/Landmarks/Adapters/landmarkSizeAdapter.js +23 -0
  77. package/lib/Components/Landmarks/Controller/MouseLandmark.d.ts +3 -13
  78. package/lib/Components/Landmarks/Controller/MouseLandmark.js +8 -16
  79. package/lib/Components/Landmarks/Controller/SubmitLandmarkSize.d.ts +1 -1
  80. package/lib/Components/Landmarks/Controller/SubmitLandmarkSize.js +2 -8
  81. package/lib/Components/Landmarks/Controller/TouchLandmark.d.ts +2 -12
  82. package/lib/Components/Landmarks/Controller/TouchLandmark.js +12 -19
  83. package/lib/Components/Landmarks/Controller/UpdateLandmarkSize.d.ts +1 -1
  84. package/lib/Components/Landmarks/Controller/UpdateLandmarkSize.js +3 -9
  85. package/lib/Components/Landmarks/Controller/deleteAllLandmarks.d.ts +2 -0
  86. package/lib/Components/Landmarks/Controller/deleteAllLandmarks.js +13 -0
  87. package/lib/Components/Landmarks/Controller/deleteLandmark.d.ts +2 -0
  88. package/lib/Components/Landmarks/Controller/deleteLandmark.js +14 -0
  89. package/lib/Components/Landmarks/Controller/index.d.ts +2 -1
  90. package/lib/Components/Landmarks/Controller/index.js +2 -1
  91. package/lib/Components/Landmarks/Controller/submitLandmarkSizeX.d.ts +2 -0
  92. package/lib/Components/Landmarks/Controller/submitLandmarkSizeX.js +19 -0
  93. package/lib/Components/Landmarks/Controller/updateLandmarkSizeX.d.ts +2 -0
  94. package/lib/Components/Landmarks/Controller/updateLandmarkSizeX.js +19 -0
  95. package/lib/Components/Landmarks/Entities/LandmarkEntity.d.ts +5 -3
  96. package/lib/Components/Landmarks/Entities/LandmarkEntity.js +18 -6
  97. package/lib/Components/Landmarks/Entities/LandmarkGlobals.d.ts +2 -3
  98. package/lib/Components/Landmarks/Entities/LandmarkGlobals.js +5 -10
  99. package/lib/Components/Landmarks/Entities/LandmarkRepo.d.ts +7 -1
  100. package/lib/Components/Landmarks/Entities/LandmarkRepo.js +26 -4
  101. package/lib/Components/Landmarks/Mocks/DeleteAllLandmarksUcMock.d.ts +8 -0
  102. package/lib/Components/Landmarks/Mocks/DeleteAllLandmarksUcMock.js +15 -0
  103. package/lib/Components/Landmarks/Mocks/DeleteLandmarkUcMock.d.ts +7 -0
  104. package/lib/Components/Landmarks/Mocks/DeleteLandmarkUcMock.js +11 -0
  105. package/lib/Components/Landmarks/Mocks/LandmarkListPmMock.d.ts +7 -0
  106. package/lib/Components/Landmarks/Mocks/LandmarkListPmMock.js +11 -0
  107. package/lib/Components/Landmarks/Mocks/LandmarkSizePmMock.d.ts +7 -0
  108. package/lib/Components/Landmarks/Mocks/LandmarkSizePmMock.js +11 -0
  109. package/lib/Components/Landmarks/Mocks/MockLandmark.d.ts +3 -1
  110. package/lib/Components/Landmarks/Mocks/MockLandmark.js +9 -0
  111. package/lib/Components/Landmarks/Mocks/MockTryAddNewLandmarkUC.d.ts +10 -0
  112. package/lib/Components/Landmarks/Mocks/MockTryAddNewLandmarkUC.js +17 -0
  113. package/lib/Components/Landmarks/Mocks/MockTryPreviewLandmarkUC.d.ts +10 -0
  114. package/lib/Components/Landmarks/Mocks/MockTryPreviewLandmarkUC.js +17 -0
  115. package/lib/Components/Landmarks/Mocks/SetLandmarkSizeUcMark.d.ts +8 -0
  116. package/lib/Components/Landmarks/Mocks/SetLandmarkSizeUcMark.js +12 -0
  117. package/lib/Components/Landmarks/Mocks/index.d.ts +6 -0
  118. package/lib/Components/Landmarks/Mocks/index.js +18 -0
  119. package/lib/Components/Landmarks/Mocks/makeLandmarkDTO.d.ts +2 -0
  120. package/lib/Components/Landmarks/Mocks/makeLandmarkDTO.js +20 -0
  121. package/lib/Components/Landmarks/PM/LandmarkListPM.d.ts +4 -8
  122. package/lib/Components/Landmarks/PM/LandmarkListPM.js +19 -26
  123. package/lib/Components/Landmarks/PM/LandmarkSizePM.d.ts +4 -8
  124. package/lib/Components/Landmarks/PM/LandmarkSizePM.js +19 -20
  125. package/lib/Components/Landmarks/UseCases/AddLandmarkUndoRedo.d.ts +4 -6
  126. package/lib/Components/Landmarks/UseCases/AddLandmarkUndoRedo.js +14 -27
  127. package/lib/Components/Landmarks/UseCases/DeleteAllLandmarksUC.d.ts +7 -0
  128. package/lib/Components/Landmarks/UseCases/DeleteAllLandmarksUC.js +35 -0
  129. package/lib/Components/Landmarks/UseCases/DeleteAllLandmarksUndoRedo.d.ts +10 -0
  130. package/lib/Components/Landmarks/UseCases/DeleteAllLandmarksUndoRedo.js +37 -0
  131. package/lib/Components/Landmarks/UseCases/DeleteLandmarkUC.d.ts +5 -6
  132. package/lib/Components/Landmarks/UseCases/DeleteLandmarkUC.js +24 -34
  133. package/lib/Components/Landmarks/UseCases/DeleteLandmarkUndoRedo.d.ts +4 -6
  134. package/lib/Components/Landmarks/UseCases/DeleteLandmarkUndoRedo.js +14 -27
  135. package/lib/Components/Landmarks/UseCases/SerializeLandmarks.d.ts +2 -0
  136. package/lib/Components/Landmarks/UseCases/SerializeLandmarks.js +27 -40
  137. package/lib/Components/Landmarks/UseCases/SetLandmarkSizeUC.d.ts +6 -9
  138. package/lib/Components/Landmarks/UseCases/SetLandmarkSizeUC.js +33 -27
  139. package/lib/Components/Landmarks/UseCases/SetLandmarkSizeUndoRedo.d.ts +10 -6
  140. package/lib/Components/Landmarks/UseCases/SetLandmarkSizeUndoRedo.js +11 -20
  141. package/lib/Components/Landmarks/UseCases/TryAddNewLandmarkUC.d.ts +1 -0
  142. package/lib/Components/Landmarks/UseCases/TryAddNewLandmarkUC.js +22 -18
  143. package/lib/Components/Landmarks/UseCases/TryPreviewLandmarkUC.d.ts +3 -8
  144. package/lib/Components/Landmarks/UseCases/TryPreviewLandmarkUC.js +17 -18
  145. package/lib/Components/Landmarks/UseCases/index.d.ts +1 -1
  146. package/lib/Components/Landmarks/UseCases/index.js +1 -1
  147. package/lib/Components/Landmarks/index.d.ts +2 -0
  148. package/lib/Components/Landmarks/index.js +2 -0
  149. package/lib/Components/StateMachine/Entities/StateMachineEntity.d.ts +1 -1
  150. package/lib/Components/StateMachine/Entities/StateMachineEntity.js +6 -2
  151. package/lib/Components/zSpace/Adapters/index.d.ts +4 -0
  152. package/lib/Components/zSpace/Adapters/index.js +16 -0
  153. package/lib/Components/zSpace/Adapters/zSpaceDisplayAdapter.d.ts +3 -0
  154. package/lib/Components/zSpace/Adapters/zSpaceDisplayAdapter.js +23 -0
  155. package/lib/Components/zSpace/Adapters/zSpaceIsEnabledAdapter.d.ts +2 -0
  156. package/lib/Components/zSpace/Adapters/zSpaceIsEnabledAdapter.js +23 -0
  157. package/lib/Components/zSpace/Adapters/zSpaceIsSupportedAdapter.d.ts +2 -0
  158. package/lib/Components/zSpace/Adapters/zSpaceIsSupportedAdapter.js +23 -0
  159. package/lib/Components/zSpace/Adapters/zSpaceViewerScaleAdapter.d.ts +2 -0
  160. package/lib/Components/zSpace/Adapters/zSpaceViewerScaleAdapter.js +23 -0
  161. package/lib/Components/zSpace/Mocks/ZSpaceDisplayPmMock.d.ts +8 -0
  162. package/lib/Components/zSpace/Mocks/ZSpaceDisplayPmMock.js +15 -0
  163. package/lib/Components/zSpace/Mocks/ZSpaceIsEnabledPmMock.d.ts +8 -0
  164. package/lib/Components/zSpace/Mocks/ZSpaceIsEnabledPmMock.js +15 -0
  165. package/lib/Components/zSpace/Mocks/ZSpaceIsSupportedPmMock.d.ts +8 -0
  166. package/lib/Components/zSpace/Mocks/ZSpaceIsSupportedPmMock.js +15 -0
  167. package/lib/Components/zSpace/Mocks/ZSpaceViewerScalePmMock.d.ts +8 -0
  168. package/lib/Components/zSpace/Mocks/ZSpaceViewerScalePmMock.js +15 -0
  169. package/lib/Components/zSpace/Mocks/index.d.ts +5 -0
  170. package/lib/Components/zSpace/Mocks/index.js +17 -0
  171. package/lib/Components/zSpace/PM/ZSpaceDisplayPM.d.ts +3 -0
  172. package/lib/Components/zSpace/PM/ZSpaceDisplayPM.js +20 -25
  173. package/lib/Components/zSpace/PM/ZSpaceIsEnabledPM.d.ts +2 -0
  174. package/lib/Components/zSpace/PM/ZSpaceIsEnabledPM.js +10 -16
  175. package/lib/Components/zSpace/PM/ZSpaceIsSupportedPM.js +10 -18
  176. package/lib/Components/zSpace/PM/ZSpaceViewerScalePM.d.ts +2 -1
  177. package/lib/Components/zSpace/PM/ZSpaceViewerScalePM.js +9 -16
  178. package/lib/Components/zSpace/index.d.ts +2 -0
  179. package/lib/Components/zSpace/index.js +2 -0
  180. package/lib/Entities/RangedNumber.d.ts +16 -0
  181. package/lib/Entities/RangedNumber.js +35 -0
  182. package/lib/Entities/index.d.ts +1 -0
  183. package/lib/Entities/index.js +1 -0
  184. package/package.json +1 -1
@@ -1,22 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeZSpaceDisplayPM = exports.ZSpaceDisplayPM = void 0;
3
+ exports.makeZSpaceDisplayPM = exports.ZSpaceDisplayPM = exports.defaultZSpaceDisplayVM = void 0;
4
+ const AppObject_1 = require("../../../AppObject");
4
5
  const AppObjectPM_1 = require("../../../AppObject/AppObjectPM");
5
6
  const ValueObjects_1 = require("../../../ValueObjects");
6
7
  const ZSpaceDisplayEntity_1 = require("../Entities/ZSpaceDisplayEntity");
7
8
  const ZSpaceEntity_1 = require("../Entities/ZSpaceEntity");
9
+ exports.defaultZSpaceDisplayVM = {
10
+ pixelSize: ValueObjects_1.Vector2.Zero(),
11
+ show: false,
12
+ worldSize: ValueObjects_1.Vector2.Zero(),
13
+ };
8
14
  class ZSpaceDisplayPM extends AppObjectPM_1.AppObjectPM {
9
15
  }
10
16
  exports.ZSpaceDisplayPM = ZSpaceDisplayPM;
11
17
  ZSpaceDisplayPM.type = "ZSpaceDisplayPM";
18
+ ZSpaceDisplayPM.get = (appObjects) => AppObject_1.getSingletonComponent(ZSpaceDisplayPM.type, appObjects);
12
19
  function makeZSpaceDisplayPM(appObject) {
13
20
  return new ZSpaceDisplayPMImp(appObject);
14
21
  }
15
22
  exports.makeZSpaceDisplayPM = makeZSpaceDisplayPM;
16
23
  class ZSpaceDisplayPMImp extends ZSpaceDisplayPM {
17
24
  constructor(appObject) {
25
+ var _a, _b;
18
26
  super(appObject, ZSpaceDisplayPM.type);
19
- this.onEntityChange = () => {
27
+ this.onZSpaceChange = () => {
20
28
  var _a, _b;
21
29
  if (!this.zSpaceDisplay)
22
30
  return;
@@ -28,29 +36,16 @@ class ZSpaceDisplayPMImp extends ZSpaceDisplayPM {
28
36
  };
29
37
  this.doUpdateView(vm);
30
38
  };
31
- this.dispose = () => {
32
- var _a, _b, _c, _d;
33
- super.dispose();
34
- (_a = this.zSpaceDisplay) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onEntityChange);
35
- (_b = this.zSpaceDisplay) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
36
- (_c = this.zSpaceEntity) === null || _c === void 0 ? void 0 : _c.removeChangeObserver(this.onEntityChange);
37
- (_d = this.zSpaceEntity) === null || _d === void 0 ? void 0 : _d.removeOnDisposeObserver(this.dispose);
38
- };
39
- this.zSpaceDisplay = appObject.getComponent(ZSpaceDisplayEntity_1.ZSpaceDisplayEntity.type);
40
- if (!this.zSpaceDisplay) {
41
- this.warn("App Object does not have a ZSpace Display Entity");
42
- return;
43
- }
44
- this.zSpaceEntity = ZSpaceEntity_1.ZSpaceEntity.get(appObject.appObjectRepo);
45
- if (!this.zSpaceEntity) {
46
- this.warn("Could not find a ZSpace Entity");
47
- return;
48
- }
49
- this.zSpaceDisplay.addChangeObserver(this.onEntityChange);
50
- this.zSpaceDisplay.addOnDisposeObserver(this.dispose);
51
- this.zSpaceEntity.addChangeObserver(this.onEntityChange);
52
- this.zSpaceEntity.addOnDisposeObserver(this.dispose);
53
- this.onEntityChange();
39
+ (_a = this.zSpaceDisplay) === null || _a === void 0 ? void 0 : _a.addChangeObserver(this.onZSpaceChange);
40
+ (_b = this.zSpaceEntity) === null || _b === void 0 ? void 0 : _b.addChangeObserver(this.onZSpaceChange);
41
+ this.onZSpaceChange();
42
+ this.appObjects.registerSingleton(this);
43
+ }
44
+ get zSpaceDisplay() {
45
+ return this.getCachedSingleton(ZSpaceDisplayEntity_1.ZSpaceDisplayEntity.type);
46
+ }
47
+ get zSpaceEntity() {
48
+ return this.getCachedSingleton(ZSpaceEntity_1.ZSpaceEntity.type);
54
49
  }
55
50
  vmsAreEqual(a, b) {
56
51
  if (a.show === b.show &&
@@ -1,6 +1,8 @@
1
+ import { AppObjectRepo } from "../../../AppObject";
1
2
  import { AppObject } from "../../../AppObject/AppObject";
2
3
  import { AppObjectPM } from "../../../AppObject/AppObjectPM";
3
4
  export declare abstract class ZSpaceIsEnabledPM extends AppObjectPM<boolean> {
4
5
  static readonly type = "ZSpaceIsEnabledPM";
6
+ static get: (appObjects: AppObjectRepo) => ZSpaceIsEnabledPM | undefined;
5
7
  }
6
8
  export declare function makeZSpaceIsEnabledPM(appObject: AppObject): ZSpaceIsEnabledPM;
@@ -1,39 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeZSpaceIsEnabledPM = exports.ZSpaceIsEnabledPM = void 0;
4
+ const AppObject_1 = require("../../../AppObject");
4
5
  const AppObjectPM_1 = require("../../../AppObject/AppObjectPM");
5
6
  const ZSpaceEntity_1 = require("../Entities/ZSpaceEntity");
6
7
  class ZSpaceIsEnabledPM extends AppObjectPM_1.AppObjectPM {
7
8
  }
8
9
  exports.ZSpaceIsEnabledPM = ZSpaceIsEnabledPM;
9
10
  ZSpaceIsEnabledPM.type = "ZSpaceIsEnabledPM";
11
+ ZSpaceIsEnabledPM.get = (appObjects) => AppObject_1.getSingletonComponent(ZSpaceIsEnabledPM.type, appObjects);
10
12
  function makeZSpaceIsEnabledPM(appObject) {
11
13
  return new ZSpaceIsEnabledPMImp(appObject);
12
14
  }
13
15
  exports.makeZSpaceIsEnabledPM = makeZSpaceIsEnabledPM;
14
16
  class ZSpaceIsEnabledPMImp extends ZSpaceIsEnabledPM {
15
17
  constructor(appObject) {
18
+ var _a;
16
19
  super(appObject, ZSpaceIsEnabledPM.type);
17
- this.onRepoChange = () => {
20
+ this.onZSpaceChange = () => {
18
21
  if (!this.zSpace)
19
22
  return;
20
23
  this.doUpdateView(this.zSpace.enabled);
21
24
  };
22
- this.dispose = () => {
23
- var _a, _b;
24
- super.dispose();
25
- (_a = this.zSpace) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onRepoChange);
26
- (_b = this.zSpace) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
27
- };
28
- this.zSpace = appObject.getComponent(ZSpaceEntity_1.ZSpaceEntity.type);
29
- if (this.zSpace) {
30
- this.zSpace.addChangeObserver(this.onRepoChange);
31
- this.zSpace.addOnDisposeObserver(() => this.dispose());
32
- this.onRepoChange();
33
- }
34
- else {
35
- this.warn("App Object does not have a ZSpace Entity");
36
- }
25
+ (_a = this.zSpace) === null || _a === void 0 ? void 0 : _a.addChangeObserver(this.onZSpaceChange);
26
+ this.onZSpaceChange();
27
+ this.appObjects.registerSingleton(this);
28
+ }
29
+ get zSpace() {
30
+ return this.getCachedSingleton(ZSpaceEntity_1.ZSpaceEntity.type);
37
31
  }
38
32
  vmsAreEqual(a, b) {
39
33
  return a === b;
@@ -15,27 +15,19 @@ function makeZSpaceIsSupportedPM(appObject) {
15
15
  exports.makeZSpaceIsSupportedPM = makeZSpaceIsSupportedPM;
16
16
  class ZSpaceIsSupportedPMImp extends ZSpaceIsSupportedPM {
17
17
  constructor(appObject) {
18
+ var _a;
18
19
  super(appObject, ZSpaceIsSupportedPM.type);
19
- this.onRepoChange = () => {
20
- if (!this.zSpace)
20
+ this.onZSpaceChange = () => {
21
+ if (!this.zSpaceEntity)
21
22
  return;
22
- this.doUpdateView(this.zSpace.isSupported);
23
+ this.doUpdateView(this.zSpaceEntity.isSupported);
23
24
  };
24
- this.dispose = () => {
25
- var _a, _b;
26
- super.dispose();
27
- (_a = this.zSpace) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onRepoChange);
28
- (_b = this.zSpace) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
29
- };
30
- this.zSpace = appObject.getComponent(ZSpaceEntity_1.ZSpaceEntity.type);
31
- if (this.zSpace) {
32
- this.zSpace.addChangeObserver(this.onRepoChange);
33
- this.zSpace.addOnDisposeObserver(() => this.dispose());
34
- this.onRepoChange();
35
- }
36
- else {
37
- this.warn("App Object does not have a ZSpace Entity");
38
- }
25
+ (_a = this.zSpaceEntity) === null || _a === void 0 ? void 0 : _a.addChangeObserver(this.onZSpaceChange);
26
+ this.onZSpaceChange();
27
+ this.appObjects.registerSingleton(this);
28
+ }
29
+ get zSpaceEntity() {
30
+ return this.getCachedSingleton(ZSpaceEntity_1.ZSpaceEntity.type);
39
31
  }
40
32
  vmsAreEqual(a, b) {
41
33
  return a === b;
@@ -1,5 +1,6 @@
1
- import { AppObject, AppObjectPM } from "../../../AppObject";
1
+ import { AppObject, AppObjectPM, AppObjectRepo } from "../../../AppObject";
2
2
  export declare abstract class ZSpaceViewerScalePM extends AppObjectPM<number> {
3
3
  static readonly type = "ZSpaceViewerScalePM";
4
+ static get: (appObjects: AppObjectRepo) => ZSpaceViewerScalePM | undefined;
4
5
  }
5
6
  export declare function makeZSpaceViewerScalePM(appObject: AppObject): ZSpaceViewerScalePM;
@@ -7,33 +7,26 @@ class ZSpaceViewerScalePM extends AppObject_1.AppObjectPM {
7
7
  }
8
8
  exports.ZSpaceViewerScalePM = ZSpaceViewerScalePM;
9
9
  ZSpaceViewerScalePM.type = "ZSpaceViewerScalePM";
10
+ ZSpaceViewerScalePM.get = (appObjects) => AppObject_1.getSingletonComponent(ZSpaceViewerScalePM.type, appObjects);
10
11
  function makeZSpaceViewerScalePM(appObject) {
11
12
  return new ZSpaceViewerScalePMImp(appObject);
12
13
  }
13
14
  exports.makeZSpaceViewerScalePM = makeZSpaceViewerScalePM;
14
15
  class ZSpaceViewerScalePMImp extends ZSpaceViewerScalePM {
15
16
  constructor(appObject) {
17
+ var _a;
16
18
  super(appObject, ZSpaceViewerScalePM.type);
17
- this.onRepoChange = () => {
19
+ this.onZSpaceChange = () => {
18
20
  if (!this.zSpace)
19
21
  return;
20
22
  this.doUpdateView(this.zSpace.viewerScale);
21
23
  };
22
- this.dispose = () => {
23
- var _a, _b;
24
- super.dispose();
25
- (_a = this.zSpace) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onRepoChange);
26
- (_b = this.zSpace) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
27
- };
28
- this.zSpace = appObject.getComponent(ZSpaceEntity_1.ZSpaceEntity.type);
29
- if (this.zSpace) {
30
- this.zSpace.addChangeObserver(this.onRepoChange);
31
- this.zSpace.addOnDisposeObserver(() => this.dispose());
32
- this.onRepoChange();
33
- }
34
- else {
35
- this.warn("App Object does not have a ZSpace Entity");
36
- }
24
+ (_a = this.zSpace) === null || _a === void 0 ? void 0 : _a.addChangeObserver(this.onZSpaceChange);
25
+ this.onZSpaceChange();
26
+ this.appObjects.registerSingleton(this);
27
+ }
28
+ get zSpace() {
29
+ return this.getCachedSingleton(ZSpaceEntity_1.ZSpaceEntity.type);
37
30
  }
38
31
  vmsAreEqual(a, b) {
39
32
  return a === b;
@@ -1,3 +1,5 @@
1
+ export * from "./Adapters";
1
2
  export * from "./Entities";
3
+ export * from "./Mocks";
2
4
  export * from "./PM";
3
5
  export * from "./UC";
@@ -10,6 +10,8 @@ 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
+ __exportStar(require("./Adapters"), exports);
13
14
  __exportStar(require("./Entities"), exports);
15
+ __exportStar(require("./Mocks"), exports);
14
16
  __exportStar(require("./PM"), exports);
15
17
  __exportStar(require("./UC"), exports);
@@ -0,0 +1,16 @@
1
+ export interface RangedNumberProperties {
2
+ min: number;
3
+ max: number;
4
+ initialValue: number;
5
+ }
6
+ export declare class RangedNumber {
7
+ readonly maxValue: number;
8
+ readonly minValue: number;
9
+ private _val;
10
+ get val(): number;
11
+ set val(x: number);
12
+ setValQuietly(val: number): void;
13
+ private clamp;
14
+ private onChangeCallback;
15
+ constructor(props: RangedNumberProperties, onChangeCallback: () => void);
16
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RangedNumber = void 0;
4
+ class RangedNumber {
5
+ constructor(props, onChangeCallback) {
6
+ this.maxValue = props.max;
7
+ this.minValue = props.min;
8
+ this._val = this.clamp(props.initialValue);
9
+ this.onChangeCallback = onChangeCallback;
10
+ }
11
+ get val() {
12
+ return this._val;
13
+ }
14
+ set val(x) {
15
+ const y = this.clamp(x);
16
+ if (this._val === y)
17
+ return;
18
+ this._val = y;
19
+ this.onChangeCallback();
20
+ }
21
+ setValQuietly(val) {
22
+ this._val = this.clamp(val);
23
+ }
24
+ clamp(x) {
25
+ let rVal = x;
26
+ if (x > this.maxValue) {
27
+ rVal = this.maxValue;
28
+ }
29
+ else if (x < this.minValue) {
30
+ rVal = this.minValue;
31
+ }
32
+ return rVal;
33
+ }
34
+ }
35
+ exports.RangedNumber = RangedNumber;
@@ -1,6 +1,7 @@
1
1
  export * from "./MessageSystem";
2
2
  export * from "./ObservableEntity";
3
3
  export * from "./ObserverList";
4
+ export * from "./RangedNumber";
4
5
  export * from "./TransformNode";
5
6
  export * from "./WorkPlane";
6
7
  export * from "./MemoizedAngle";
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./MessageSystem"), exports);
14
14
  __exportStar(require("./ObservableEntity"), exports);
15
15
  __exportStar(require("./ObserverList"), exports);
16
+ __exportStar(require("./RangedNumber"), exports);
16
17
  __exportStar(require("./TransformNode"), exports);
17
18
  __exportStar(require("./WorkPlane"), exports);
18
19
  __exportStar(require("./MemoizedAngle"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vived/app",
3
- "version": "4.24.0",
3
+ "version": "4.26.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",