@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,10 +1,6 @@
1
- import { AppObject, AppObjectPM } from "../../../AppObject";
2
- export declare class LandmarkSizePM extends AppObjectPM<number> {
1
+ import { AppObject, AppObjectPM, AppObjectRepo } from "../../../AppObject";
2
+ export declare abstract class LandmarkSizePM extends AppObjectPM<number> {
3
3
  static readonly type = "LandmarkSizePM";
4
- static addIfMissing(appObj: AppObject): LandmarkSizePM;
5
- private landmarkEntity?;
6
- vmsAreEqual(a: number, b: number): boolean;
7
- onRepoChange: () => void;
8
- dispose: () => void;
9
- constructor(appObject: AppObject);
4
+ static get(id: string, appObjects: AppObjectRepo): LandmarkSizePM | undefined;
10
5
  }
6
+ export declare function makeLandmarkSizePM(appObject: AppObject): LandmarkSizePM;
@@ -1,10 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LandmarkSizePM = void 0;
3
+ exports.makeLandmarkSizePM = exports.LandmarkSizePM = void 0;
4
4
  const AppObject_1 = require("../../../AppObject");
5
5
  const LandmarkEntity_1 = require("../Entities/LandmarkEntity");
6
6
  class LandmarkSizePM extends AppObject_1.AppObjectPM {
7
+ static get(id, appObjects) {
8
+ var _a;
9
+ return (_a = appObjects
10
+ .get(id)) === null || _a === void 0 ? void 0 : _a.getComponent(LandmarkSizePM.type);
11
+ }
12
+ }
13
+ exports.LandmarkSizePM = LandmarkSizePM;
14
+ LandmarkSizePM.type = "LandmarkSizePM";
15
+ function makeLandmarkSizePM(appObject) {
16
+ return new LandmarkSizePMImp(appObject);
17
+ }
18
+ exports.makeLandmarkSizePM = makeLandmarkSizePM;
19
+ class LandmarkSizePMImp extends LandmarkSizePM {
7
20
  constructor(appObject) {
21
+ var _a;
8
22
  super(appObject, LandmarkSizePM.type);
9
23
  this.onRepoChange = () => {
10
24
  if (!this.landmarkEntity)
@@ -17,28 +31,13 @@ class LandmarkSizePM extends AppObject_1.AppObjectPM {
17
31
  (_a = this.landmarkEntity) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onRepoChange);
18
32
  (_b = this.landmarkEntity) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
19
33
  };
20
- this.landmarkEntity = appObject.getComponent(LandmarkEntity_1.LandmarkEntity.type);
21
- if (this.landmarkEntity) {
22
- this.landmarkEntity.addChangeObserver(this.onRepoChange);
23
- this.landmarkEntity.addOnDisposeObserver(() => this.dispose());
24
- this.onRepoChange();
25
- }
26
- else {
27
- console.warn("[LandmarkSizePM] App Object does not have a LandmarkEntity Entity");
28
- }
34
+ (_a = this.landmarkEntity) === null || _a === void 0 ? void 0 : _a.addChangeObserver(this.onRepoChange);
35
+ this.onRepoChange();
29
36
  }
30
- static addIfMissing(appObj) {
31
- const existing = appObj.getComponent(LandmarkSizePM.type);
32
- if (existing) {
33
- return existing;
34
- }
35
- else {
36
- return new LandmarkSizePM(appObj);
37
- }
37
+ get landmarkEntity() {
38
+ return this.getCachedLocalComponent(LandmarkEntity_1.LandmarkEntity.type);
38
39
  }
39
40
  vmsAreEqual(a, b) {
40
41
  return a === b;
41
42
  }
42
43
  }
43
- exports.LandmarkSizePM = LandmarkSizePM;
44
- LandmarkSizePM.type = "LandmarkSizePM";
@@ -1,13 +1,11 @@
1
- import { AppObject } from "../../../AppObject";
1
+ import { AppObjectRepo } from "../../../AppObject";
2
2
  import { UndoRedoAction } from "../../UndoRedo/Entities/UndoRedoEntity";
3
3
  import { LandmarkDTO } from "../Entities/LandmarkEntity";
4
4
  export declare class AddLandmarkUndoRedo implements UndoRedoAction {
5
5
  private landmarkDTO;
6
- private appObject;
7
- private landmarkRepo?;
8
- private addLandmarkUC?;
9
- private deleteLandmarkUC?;
6
+ private appObjects;
7
+ private get landmarkRepo();
10
8
  undoAction: () => void;
11
9
  redoAction: () => void;
12
- constructor(landmarkDTO: LandmarkDTO, appObject: AppObject);
10
+ constructor(landmarkDTO: LandmarkDTO, appObjects: AppObjectRepo);
13
11
  }
@@ -4,45 +4,32 @@ exports.AddLandmarkUndoRedo = void 0;
4
4
  const DispatchStateChangeUC_1 = require("../../Dispatcher/UC/DispatchStateChangeUC");
5
5
  const UndoRedoEntity_1 = require("../../UndoRedo/Entities/UndoRedoEntity");
6
6
  const LandmarkRepo_1 = require("../Entities/LandmarkRepo");
7
- const AddLandmarkUC_1 = require("./AddLandmarkUC");
8
- const DeleteLandmarkUC_1 = require("./DeleteLandmarkUC");
9
7
  class AddLandmarkUndoRedo {
10
- constructor(landmarkDTO, appObject) {
8
+ constructor(landmarkDTO, appObjects) {
11
9
  this.landmarkDTO = landmarkDTO;
12
- this.appObject = appObject;
10
+ this.appObjects = appObjects;
13
11
  this.undoAction = () => {
14
- if (!this.deleteLandmarkUC)
12
+ if (!this.landmarkRepo)
15
13
  return;
16
- this.deleteLandmarkUC.deleteLandmark(this.landmarkDTO.id, true);
17
- DispatchStateChangeUC_1.dispatchStateChange(this.appObject.appObjectRepo);
14
+ this.landmarkRepo.deleteLandmark(this.landmarkDTO.id);
15
+ DispatchStateChangeUC_1.dispatchStateChange(this.appObjects);
18
16
  };
19
17
  this.redoAction = () => {
20
- if (!this.addLandmarkUC)
18
+ if (!this.landmarkRepo)
21
19
  return;
22
- this.addLandmarkUC.addFromData(this.landmarkDTO);
23
- DispatchStateChangeUC_1.dispatchStateChange(this.appObject.appObjectRepo);
20
+ const landmark = this.landmarkRepo.createLandmark(this.landmarkDTO.id);
21
+ landmark.data = this.landmarkDTO;
22
+ DispatchStateChangeUC_1.dispatchStateChange(this.appObjects);
24
23
  };
25
- this.landmarkRepo = appObject.getComponent(LandmarkRepo_1.LandmarkRepo.type);
26
- if (!this.landmarkRepo) {
27
- appObject.appObjectRepo.submitWarning("AddLandmarkUndoRedo", "App Object does not have a Landmark Repo");
28
- return;
29
- }
30
- this.addLandmarkUC = appObject.getComponent(AddLandmarkUC_1.AddLandmarkUC.type);
31
- if (!this.addLandmarkUC) {
32
- appObject.appObjectRepo.submitWarning("AddLandmarkUndoRedo", "App Object does not have a AddLandmarkUC");
33
- return;
34
- }
35
- this.deleteLandmarkUC = appObject.getComponent(DeleteLandmarkUC_1.DeleteLandmarkUC.type);
36
- if (!this.deleteLandmarkUC) {
37
- appObject.appObjectRepo.submitWarning("AddLandmarkUndoRedo", "App Object does not have a DeleteLandmarkUC");
38
- return;
39
- }
40
- const undoRedo = UndoRedoEntity_1.UndoRedoEntity.get(appObject.appObjectRepo);
24
+ const undoRedo = UndoRedoEntity_1.UndoRedoEntity.get(appObjects);
41
25
  if (!undoRedo) {
42
- appObject.appObjectRepo.submitWarning("AddLandmarkUndoRedo", "Unable to find UndoRedoEntity");
26
+ appObjects.submitWarning("AddLandmarkUndoRedo", "Unable to find UndoRedoEntity");
43
27
  return;
44
28
  }
45
29
  undoRedo.submitAction(this);
46
30
  }
31
+ get landmarkRepo() {
32
+ return LandmarkRepo_1.LandmarkRepo.getByID(this.landmarkDTO.parentID, this.appObjects);
33
+ }
47
34
  }
48
35
  exports.AddLandmarkUndoRedo = AddLandmarkUndoRedo;
@@ -0,0 +1,7 @@
1
+ import { AppObject, AppObjectRepo, AppObjectUC } from "../../../AppObject";
2
+ export declare abstract class DeleteAllLandmarksUC extends AppObjectUC {
3
+ static readonly type = "DeleteAllLandmarksUC";
4
+ abstract deleteAllLandmarks(): void;
5
+ static get: (appObjects: AppObjectRepo) => DeleteAllLandmarksUC | undefined;
6
+ }
7
+ export declare function makeDeleteAllLandmarksUC(appObject: AppObject): DeleteAllLandmarksUC;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeDeleteAllLandmarksUC = exports.DeleteAllLandmarksUC = void 0;
4
+ const AppObject_1 = require("../../../AppObject");
5
+ const Dispatcher_1 = require("../../Dispatcher");
6
+ const LandmarkRepo_1 = require("../Entities/LandmarkRepo");
7
+ const DeleteAllLandmarksUndoRedo_1 = require("./DeleteAllLandmarksUndoRedo");
8
+ class DeleteAllLandmarksUC extends AppObject_1.AppObjectUC {
9
+ }
10
+ exports.DeleteAllLandmarksUC = DeleteAllLandmarksUC;
11
+ DeleteAllLandmarksUC.type = "DeleteAllLandmarksUC";
12
+ DeleteAllLandmarksUC.get = (appObjects) => AppObject_1.getSingletonComponent(DeleteAllLandmarksUC.type, appObjects);
13
+ function makeDeleteAllLandmarksUC(appObject) {
14
+ return new DeleteAllCalloutsUCImp(appObject);
15
+ }
16
+ exports.makeDeleteAllLandmarksUC = makeDeleteAllLandmarksUC;
17
+ class DeleteAllCalloutsUCImp extends DeleteAllLandmarksUC {
18
+ deleteAllLandmarks() {
19
+ const deletedLandmarks = [];
20
+ const landmarkRepos = this.appObjects.getAllComponents(LandmarkRepo_1.LandmarkRepo.type);
21
+ landmarkRepos.forEach((repo) => {
22
+ const callouts = repo.getAll();
23
+ callouts.forEach((landmark) => {
24
+ deletedLandmarks.push(landmark.data);
25
+ repo.removeForAppObject(landmark.appObject.id);
26
+ landmark.appObject.dispose();
27
+ });
28
+ });
29
+ Dispatcher_1.dispatchStateChange(this.appObjects);
30
+ new DeleteAllLandmarksUndoRedo_1.DeleteAllLandmarksUndoRedo(deletedLandmarks, this.appObjects);
31
+ }
32
+ constructor(appObject) {
33
+ super(appObject, DeleteAllLandmarksUC.type);
34
+ }
35
+ }
@@ -0,0 +1,10 @@
1
+ import { AppObjectRepo } from "../../../AppObject";
2
+ import { UndoRedoAction } from "../../UndoRedo";
3
+ import { LandmarkDTO } from "../Entities/LandmarkEntity";
4
+ export declare class DeleteAllLandmarksUndoRedo implements UndoRedoAction {
5
+ private deletedLandmarks;
6
+ private appObjects;
7
+ undoAction: () => void;
8
+ redoAction: () => void;
9
+ constructor(deletedLandmarks: LandmarkDTO[], appObjects: AppObjectRepo);
10
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteAllLandmarksUndoRedo = void 0;
4
+ const Dispatcher_1 = require("../../Dispatcher");
5
+ const UndoRedo_1 = require("../../UndoRedo");
6
+ const LandmarkRepo_1 = require("../Entities/LandmarkRepo");
7
+ class DeleteAllLandmarksUndoRedo {
8
+ constructor(deletedLandmarks, appObjects) {
9
+ this.deletedLandmarks = deletedLandmarks;
10
+ this.appObjects = appObjects;
11
+ this.undoAction = () => {
12
+ this.deletedLandmarks.forEach((deletedLandmark) => {
13
+ const landmarkRepo = LandmarkRepo_1.LandmarkRepo.getByID(deletedLandmark.parentID, this.appObjects);
14
+ if (!landmarkRepo) {
15
+ return;
16
+ }
17
+ const landmark = landmarkRepo.createLandmark(deletedLandmark.id);
18
+ landmark.data = deletedLandmark;
19
+ });
20
+ Dispatcher_1.dispatchStateChange(this.appObjects);
21
+ };
22
+ this.redoAction = () => {
23
+ this.deletedLandmarks.forEach((deletedLandmark) => {
24
+ const repo = LandmarkRepo_1.LandmarkRepo.getByID(deletedLandmark.parentID, this.appObjects);
25
+ repo === null || repo === void 0 ? void 0 : repo.deleteLandmark(deletedLandmark.id);
26
+ });
27
+ Dispatcher_1.dispatchStateChange(this.appObjects);
28
+ };
29
+ const undoRedo = UndoRedo_1.UndoRedoEntity.get(appObjects);
30
+ if (!undoRedo) {
31
+ appObjects.submitWarning("DeleteAllLandmarksUndoRedo", "Unable to find UndoRedoEntity");
32
+ return;
33
+ }
34
+ undoRedo.submitAction(this);
35
+ }
36
+ }
37
+ exports.DeleteAllLandmarksUndoRedo = DeleteAllLandmarksUndoRedo;
@@ -1,9 +1,8 @@
1
- import { AppObject, AppObjectUC } from "../../../AppObject";
2
- export declare class DeleteLandmarkUC extends AppObjectUC {
1
+ import { AppObject, AppObjectRepo, AppObjectUC } from "../../../AppObject";
2
+ export declare abstract class DeleteLandmarkUC extends AppObjectUC {
3
3
  static readonly type = "DeleteLandmarkUC";
4
- private landmarkRepo?;
4
+ abstract deleteLandmark(): void;
5
5
  static get(appObj: AppObject): DeleteLandmarkUC | undefined;
6
- static addIfMissing(appObj: AppObject): DeleteLandmarkUC;
7
- deleteLandmark: (id: string, quietly?: boolean, createUndo?: boolean) => void;
8
- constructor(appObject: AppObject);
6
+ static getById(id: string, appObjs: AppObjectRepo): DeleteLandmarkUC | undefined;
9
7
  }
8
+ export declare function makeDeleteLandmarkUC(appObject: AppObject): DeleteLandmarkUC;
@@ -1,48 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeleteLandmarkUC = void 0;
3
+ exports.makeDeleteLandmarkUC = exports.DeleteLandmarkUC = void 0;
4
4
  const AppObject_1 = require("../../../AppObject");
5
5
  const Dispatcher_1 = require("../../Dispatcher");
6
6
  const Entities_1 = require("../Entities");
7
7
  const DeleteLandmarkUndoRedo_1 = require("./DeleteLandmarkUndoRedo");
8
8
  class DeleteLandmarkUC extends AppObject_1.AppObjectUC {
9
- constructor(appObject) {
10
- super(appObject, DeleteLandmarkUC.type);
11
- this.deleteLandmark = (id, quietly = false, createUndo = false) => {
12
- if (!this.landmarkRepo)
13
- return;
14
- const landmarkAppObject = this.appObjects.get(id);
15
- let landmarkEntity;
16
- if (landmarkAppObject) {
17
- landmarkEntity = Entities_1.LandmarkEntity.get(landmarkAppObject);
18
- }
19
- if (createUndo && landmarkEntity) {
20
- new DeleteLandmarkUndoRedo_1.DeleteLandmarkUndoRedo(landmarkEntity.data, this.appObject);
21
- }
22
- if (landmarkAppObject) {
23
- this.landmarkRepo.removeForAppObject(landmarkAppObject.id);
24
- landmarkAppObject.dispose();
25
- }
26
- if (!quietly) {
27
- Dispatcher_1.dispatchStateChange(this.appObjects);
28
- }
29
- };
30
- this.landmarkRepo = appObject.getComponent(Entities_1.LandmarkRepo.type);
31
- if (!this.landmarkRepo) {
32
- this.warn("App Object does not have a Landmark Repo");
33
- }
34
- }
35
9
  static get(appObj) {
36
10
  return appObj.getComponent(this.type);
37
11
  }
38
- static addIfMissing(appObj) {
39
- const existing = appObj.getComponent(this.type);
40
- if (existing)
41
- return existing;
42
- else {
43
- return new DeleteLandmarkUC(appObj);
44
- }
12
+ static getById(id, appObjs) {
13
+ var _a;
14
+ return (_a = appObjs.get(id)) === null || _a === void 0 ? void 0 : _a.getComponent(this.type);
45
15
  }
46
16
  }
47
17
  exports.DeleteLandmarkUC = DeleteLandmarkUC;
48
18
  DeleteLandmarkUC.type = "DeleteLandmarkUC";
19
+ function makeDeleteLandmarkUC(appObject) {
20
+ return new DeleteLandmarkUCImp(appObject);
21
+ }
22
+ exports.makeDeleteLandmarkUC = makeDeleteLandmarkUC;
23
+ class DeleteLandmarkUCImp extends DeleteLandmarkUC {
24
+ constructor(appObject) {
25
+ super(appObject, DeleteLandmarkUC.type);
26
+ this.deleteLandmark = () => {
27
+ var _a;
28
+ if (!this.landmark)
29
+ return;
30
+ new DeleteLandmarkUndoRedo_1.DeleteLandmarkUndoRedo(this.landmark.data, this.appObjects);
31
+ (_a = this.landmark.inRepo) === null || _a === void 0 ? void 0 : _a.deleteLandmark(this.landmark.id);
32
+ Dispatcher_1.dispatchStateChange(this.appObjects);
33
+ };
34
+ }
35
+ get landmark() {
36
+ return this.getCachedLocalComponent(Entities_1.LandmarkEntity.type);
37
+ }
38
+ }
@@ -1,13 +1,11 @@
1
- import { AppObject } from "../../../AppObject";
1
+ import { AppObjectRepo } from "../../../AppObject";
2
2
  import { UndoRedoAction } from "../../UndoRedo/Entities/UndoRedoEntity";
3
3
  import { LandmarkDTO } from "../Entities/LandmarkEntity";
4
4
  export declare class DeleteLandmarkUndoRedo implements UndoRedoAction {
5
5
  private landmarkDTO;
6
- private appObject;
7
- private landmarkRepo?;
8
- private addLandmarkUC?;
9
- private deleteLandmarkUC?;
6
+ private appObjects;
7
+ private get landmarkRepo();
10
8
  undoAction: () => void;
11
9
  redoAction: () => void;
12
- constructor(landmarkDTO: LandmarkDTO, appObject: AppObject);
10
+ constructor(landmarkDTO: LandmarkDTO, appObjects: AppObjectRepo);
13
11
  }
@@ -4,45 +4,32 @@ exports.DeleteLandmarkUndoRedo = void 0;
4
4
  const DispatchStateChangeUC_1 = require("../../Dispatcher/UC/DispatchStateChangeUC");
5
5
  const UndoRedoEntity_1 = require("../../UndoRedo/Entities/UndoRedoEntity");
6
6
  const LandmarkRepo_1 = require("../Entities/LandmarkRepo");
7
- const AddLandmarkUC_1 = require("./AddLandmarkUC");
8
- const DeleteLandmarkUC_1 = require("./DeleteLandmarkUC");
9
7
  class DeleteLandmarkUndoRedo {
10
- constructor(landmarkDTO, appObject) {
8
+ constructor(landmarkDTO, appObjects) {
11
9
  this.landmarkDTO = landmarkDTO;
12
- this.appObject = appObject;
10
+ this.appObjects = appObjects;
13
11
  this.undoAction = () => {
14
- if (!this.addLandmarkUC)
12
+ if (!this.landmarkRepo)
15
13
  return;
16
- this.addLandmarkUC.addFromData(this.landmarkDTO);
17
- DispatchStateChangeUC_1.dispatchStateChange(this.appObject.appObjectRepo);
14
+ const landmark = this.landmarkRepo.createLandmark(this.landmarkDTO.id);
15
+ landmark.data = this.landmarkDTO;
16
+ DispatchStateChangeUC_1.dispatchStateChange(this.appObjects);
18
17
  };
19
18
  this.redoAction = () => {
20
- if (!this.deleteLandmarkUC)
19
+ if (!this.landmarkRepo)
21
20
  return;
22
- this.deleteLandmarkUC.deleteLandmark(this.landmarkDTO.id, true);
23
- DispatchStateChangeUC_1.dispatchStateChange(this.appObject.appObjectRepo);
21
+ this.landmarkRepo.deleteLandmark(this.landmarkDTO.id);
22
+ DispatchStateChangeUC_1.dispatchStateChange(this.appObjects);
24
23
  };
25
- this.landmarkRepo = appObject.getComponent(LandmarkRepo_1.LandmarkRepo.type);
26
- if (!this.landmarkRepo) {
27
- appObject.appObjectRepo.submitWarning("DeleteLandmarkUndoRedo", "App Object does not have a Landmark Repo");
28
- return;
29
- }
30
- this.addLandmarkUC = appObject.getComponent(AddLandmarkUC_1.AddLandmarkUC.type);
31
- if (!this.addLandmarkUC) {
32
- appObject.appObjectRepo.submitWarning("DeleteLandmarkUndoRedo", "App Object does not have a AddLandmarkUC");
33
- return;
34
- }
35
- this.deleteLandmarkUC = appObject.getComponent(DeleteLandmarkUC_1.DeleteLandmarkUC.type);
36
- if (!this.deleteLandmarkUC) {
37
- appObject.appObjectRepo.submitWarning("DeleteLandmarkUndoRedo", "App Object does not have a DeleteLandmarkUC");
38
- return;
39
- }
40
- const undoRedo = UndoRedoEntity_1.UndoRedoEntity.get(appObject.appObjectRepo);
24
+ const undoRedo = UndoRedoEntity_1.UndoRedoEntity.get(appObjects);
41
25
  if (!undoRedo) {
42
- appObject.appObjectRepo.submitWarning("DeleteLandmarkUndoRedo", "Unable to find UndoRedoEntity");
26
+ appObjects.submitWarning("DeleteLandmarkUndoRedo", "Unable to find UndoRedoEntity");
43
27
  return;
44
28
  }
45
29
  undoRedo.submitAction(this);
46
30
  }
31
+ get landmarkRepo() {
32
+ return LandmarkRepo_1.LandmarkRepo.getByID(this.landmarkDTO.parentID, this.appObjects);
33
+ }
47
34
  }
48
35
  exports.DeleteLandmarkUndoRedo = DeleteLandmarkUndoRedo;
@@ -5,9 +5,11 @@ export declare class SerializeLandmarks extends AppObjectUC implements Serialize
5
5
  static readonly type = "SerializeLandmarks";
6
6
  name: string;
7
7
  seriliziationVersion: number;
8
+ private get globals();
8
9
  getSystemState(): object;
9
10
  applySystemState(state: object, version: number): void;
10
11
  private handleStateVersion1;
12
+ private disposeLandmark;
11
13
  applyDefaultState(): void;
12
14
  constructor(appObj: AppObject);
13
15
  }
@@ -2,18 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SerializeLandmarks = void 0;
4
4
  const AppObject_1 = require("../../../AppObject");
5
- const Entities_1 = require("../../Enablement/Entities");
6
- const Entities_2 = require("../../StateMachine/Entities");
5
+ const Entities_1 = require("../../StateMachine/Entities");
7
6
  const LandmarkEntity_1 = require("../Entities/LandmarkEntity");
8
7
  const LandmarkGlobals_1 = require("../Entities/LandmarkGlobals");
9
8
  const LandmarkRepo_1 = require("../Entities/LandmarkRepo");
10
- const AddLandmarkUC_1 = require("./AddLandmarkUC");
11
9
  class SerializeLandmarks extends AppObject_1.AppObjectUC {
12
10
  constructor(appObj) {
13
11
  super(appObj, SerializeLandmarks.type);
14
12
  this.name = "landmarks";
15
13
  this.seriliziationVersion = 1;
16
- const stateMachine = this.appObjects.getSingleton(Entities_2.StateMachineEntity.type);
14
+ const stateMachine = this.appObjects.getSingleton(Entities_1.StateMachineEntity.type);
17
15
  if (stateMachine) {
18
16
  stateMachine.registerSerializedSystem(this);
19
17
  }
@@ -21,21 +19,15 @@ class SerializeLandmarks extends AppObject_1.AppObjectUC {
21
19
  this.warn("Unable to find StateMachineEntity");
22
20
  }
23
21
  }
22
+ get globals() {
23
+ return this.getCachedSingleton(LandmarkGlobals_1.LandmarkGlobals.type);
24
+ }
24
25
  getSystemState() {
25
- const repos = this.appObjects.getAllComponents(LandmarkRepo_1.LandmarkRepo.type);
26
+ const allLandmarks = this.appObjects.getAllComponents(LandmarkEntity_1.LandmarkEntity.type);
26
27
  const landmarks = [];
27
- repos.forEach((repo) => {
28
- const enabledEntity = repo.appObject.getComponent(Entities_1.EnablementEntity.type);
29
- let enabled = false;
30
- if (enabledEntity) {
31
- enabled = enabledEntity.enabled;
32
- }
33
- if (enabled) {
34
- repo.getAll().forEach((landmark) => {
35
- if (landmark.parentID) {
36
- landmarks.push(landmark.data);
37
- }
38
- });
28
+ allLandmarks.forEach((landmark) => {
29
+ if (landmark.parentID) {
30
+ landmarks.push(landmark.data);
39
31
  }
40
32
  });
41
33
  return {
@@ -71,36 +63,31 @@ class SerializeLandmarks extends AppObject_1.AppObjectUC {
71
63
  if (existing) {
72
64
  existing.data = landmarkData;
73
65
  previousLandmarkLookup.delete(landmarkData.id);
66
+ return;
74
67
  }
75
- let addUC = this.appObjects.getAppObjectComponent(landmarkData.parentID, AddLandmarkUC_1.AddLandmarkUC.type);
76
- if (!addUC) {
77
- const globals = this.appObjects.getSingleton(LandmarkGlobals_1.LandmarkGlobals.type);
78
- const newRepoAO = (_a = globals === null || globals === void 0 ? void 0 : globals.landmarkRepoFactory(landmarkData.parentID)) === null || _a === void 0 ? void 0 : _a.appObject;
79
- addUC = newRepoAO === null || newRepoAO === void 0 ? void 0 : newRepoAO.getComponent(AddLandmarkUC_1.AddLandmarkUC.type);
80
- }
81
- if (addUC) {
82
- addUC.addFromData(landmarkData);
83
- }
84
- else {
85
- this.error("No create UC");
68
+ let repo = this.appObjects.getAppObjectComponent(landmarkData.parentID, LandmarkRepo_1.LandmarkRepo.type);
69
+ if (!repo) {
70
+ repo = (_a = this.globals) === null || _a === void 0 ? void 0 : _a.landmarkRepoFactory(landmarkData.parentID);
86
71
  }
72
+ const landmark = repo.createLandmark(landmarkData.id);
73
+ landmark.data = landmarkData;
87
74
  });
88
75
  previousLandmarkLookup.forEach((landmark) => {
89
- var _a;
90
- (_a = landmark.inRepo) === null || _a === void 0 ? void 0 : _a.removeForAppObject(landmark.appObject.id);
91
- landmark.appObject.dispose();
76
+ this.disposeLandmark(landmark);
92
77
  });
93
78
  }
79
+ disposeLandmark(landmark) {
80
+ const repo = LandmarkRepo_1.LandmarkRepo.getByID(landmark.parentID, this.appObjects);
81
+ if (repo) {
82
+ repo.deleteLandmark(landmark.appObject.id);
83
+ }
84
+ }
94
85
  applyDefaultState() {
95
- const repos = this.appObjects.getAllComponents(LandmarkRepo_1.LandmarkRepo.type);
96
- repos.forEach((repo) => {
97
- const landmarks = repo.getAll();
98
- landmarks.forEach((landmark) => {
99
- if (landmark.parentID) {
100
- landmark.appObject.dispose();
101
- repo.removeForAppObject(landmark.appObject.id);
102
- }
103
- });
86
+ const allLandmarks = this.appObjects.getAllComponents(LandmarkEntity_1.LandmarkEntity.type);
87
+ allLandmarks.forEach((landmark) => {
88
+ if (landmark.parentID) {
89
+ this.disposeLandmark(landmark);
90
+ }
104
91
  });
105
92
  }
106
93
  }
@@ -1,12 +1,9 @@
1
- import { AppObject, AppObjectUC } from "../../../AppObject";
2
- export declare class SetLandmarkSizeUC extends AppObjectUC {
1
+ import { AppObject, AppObjectRepo, AppObjectUC } from "../../../AppObject";
2
+ export declare abstract class SetLandmarkSizeUC extends AppObjectUC {
3
3
  static readonly type = "SetLandmarkSizeUC";
4
- private initialValue?;
5
- private landmark?;
6
- private landmarkGlobals?;
7
- getClampedSize(size: number): number;
8
- updateSize(size: number): void;
9
- submitSize(size: number): void;
10
- constructor(appObject: AppObject);
4
+ abstract updateSize(size: number): void;
5
+ abstract submitSize(size: number): void;
11
6
  static get(appObj: AppObject): SetLandmarkSizeUC | undefined;
7
+ static getById(id: string, appObjects: AppObjectRepo): SetLandmarkSizeUC | undefined;
12
8
  }
9
+ export declare function makeSetLandmarkSizeUC(appObject: AppObject): SetLandmarkSizeUC;
@@ -1,27 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SetLandmarkSizeUC = void 0;
3
+ exports.makeSetLandmarkSizeUC = exports.SetLandmarkSizeUC = void 0;
4
4
  const AppObject_1 = require("../../../AppObject");
5
5
  const Dispatcher_1 = require("../../Dispatcher");
6
6
  const LandmarkEntity_1 = require("../Entities/LandmarkEntity");
7
7
  const LandmarkGlobals_1 = require("../Entities/LandmarkGlobals");
8
8
  const SetLandmarkSizeUndoRedo_1 = require("./SetLandmarkSizeUndoRedo");
9
9
  class SetLandmarkSizeUC extends AppObject_1.AppObjectUC {
10
+ static get(appObj) {
11
+ return appObj.getComponent(this.type);
12
+ }
13
+ static getById(id, appObjects) {
14
+ var _a;
15
+ return (_a = appObjects.get(id)) === null || _a === void 0 ? void 0 : _a.getComponent(this.type);
16
+ }
17
+ }
18
+ exports.SetLandmarkSizeUC = SetLandmarkSizeUC;
19
+ SetLandmarkSizeUC.type = "SetLandmarkSizeUC";
20
+ function makeSetLandmarkSizeUC(appObject) {
21
+ return new SetLandmarkSizeUCImp(appObject);
22
+ }
23
+ exports.makeSetLandmarkSizeUC = makeSetLandmarkSizeUC;
24
+ class SetLandmarkSizeUCImp extends SetLandmarkSizeUC {
10
25
  constructor(appObject) {
11
26
  super(appObject, SetLandmarkSizeUC.type);
12
- this.landmark = appObject.getComponent(LandmarkEntity_1.LandmarkEntity.type);
13
- if (!this.landmark) {
14
- this.warn("SetLandmarkSizeUC has been added to an App Object that does not have a LandmarkEntity. Add a LandmarkEntity before adding the UC");
15
- return;
16
- }
17
- this.landmarkGlobals = LandmarkGlobals_1.LandmarkGlobals.get(this.appObjects);
18
- if (!this.landmarkGlobals) {
19
- this.warn("SetLandmarkSizeUC has been added to an App Object but LandmarkGlobals Entity was not added. Add a LandmarkGlobals Entity");
20
- return;
21
- }
22
27
  }
23
- getClampedSize(size) {
24
- return Math.max(LandmarkEntity_1.LANDMARK_MINIMUM_SIZE, Math.min(LandmarkEntity_1.LANDMARK_MAXIMUM_SIZE, size));
28
+ get landmark() {
29
+ return this.getCachedLocalComponent(LandmarkEntity_1.LandmarkEntity.type);
30
+ }
31
+ get landmarkGlobals() {
32
+ return this.getCachedSingleton(LandmarkGlobals_1.LandmarkGlobals.type);
25
33
  }
26
34
  updateSize(size) {
27
35
  if (!this.landmark)
@@ -29,11 +37,9 @@ class SetLandmarkSizeUC extends AppObject_1.AppObjectUC {
29
37
  if (!this.landmarkGlobals)
30
38
  return;
31
39
  if (this.initialValue === undefined) {
32
- this.initialValue = size;
40
+ this.initialValue = this.landmark.size;
33
41
  }
34
- const clampedSize = this.getClampedSize(size);
35
- this.landmark.size = clampedSize;
36
- this.landmarkGlobals.lastSize = clampedSize;
42
+ this.landmark.size = size;
37
43
  }
38
44
  submitSize(size) {
39
45
  if (!this.initialValue)
@@ -42,16 +48,16 @@ class SetLandmarkSizeUC extends AppObject_1.AppObjectUC {
42
48
  return;
43
49
  if (!this.landmarkGlobals)
44
50
  return;
45
- const clampedSize = this.getClampedSize(size);
46
- this.landmark.size = clampedSize;
47
- this.landmarkGlobals.lastSize = clampedSize;
48
- new SetLandmarkSizeUndoRedo_1.SetLandmarkSizeUndoRedo(clampedSize, this.initialValue, this.appObject);
49
- Dispatcher_1.dispatchStateChange(this.appObjects);
51
+ this.landmark.size = size;
52
+ this.landmarkGlobals.lastSize = size;
53
+ if (this.initialValue && this.initialValue !== this.landmark.size) {
54
+ new SetLandmarkSizeUndoRedo_1.SetLandmarkSizeUndoRedo({
55
+ landmark: this.landmark,
56
+ redoSize: this.landmark.size,
57
+ undoSize: this.initialValue,
58
+ }, this.appObjects);
59
+ Dispatcher_1.dispatchStateChange(this.appObjects);
60
+ }
50
61
  this.initialValue = undefined;
51
62
  }
52
- static get(appObj) {
53
- return appObj.getComponent(this.type);
54
- }
55
63
  }
56
- exports.SetLandmarkSizeUC = SetLandmarkSizeUC;
57
- SetLandmarkSizeUC.type = "SetLandmarkSizeUC";