@vived/app 4.8.0 → 4.8.2

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 (41) hide show
  1. package/lib/Components/index.d.ts +0 -1
  2. package/lib/Components/index.js +0 -1
  3. package/lib/Utilities/easeFunctions.d.ts +19 -0
  4. package/lib/Utilities/easeFunctions.js +178 -0
  5. package/lib/Utilities/index.d.ts +1 -0
  6. package/lib/Utilities/index.js +1 -0
  7. package/package.json +1 -1
  8. package/lib/Components/App/UC/submitError.d.ts +0 -2
  9. package/lib/Components/App/UC/submitError.js +0 -28
  10. package/lib/Components/App/UC/submitFatal.d.ts +0 -2
  11. package/lib/Components/App/UC/submitFatal.js +0 -28
  12. package/lib/Components/App/UC/submitLog.d.ts +0 -2
  13. package/lib/Components/App/UC/submitLog.js +0 -28
  14. package/lib/Components/App/UC/submitWarning.d.ts +0 -2
  15. package/lib/Components/App/UC/submitWarning.js +0 -28
  16. package/lib/Components/Camera/Factory/CameraFactoryImp.d.ts +0 -4
  17. package/lib/Components/Camera/Factory/CameraFactoryImp.js +0 -25
  18. package/lib/Components/Dispatcher/Mocks/MockLogUC.d.ts +0 -10
  19. package/lib/Components/Dispatcher/Mocks/MockLogUC.js +0 -14
  20. package/lib/Components/Ease/Entites/AllLinearEase.d.ts +0 -22
  21. package/lib/Components/Ease/Entites/AllLinearEase.js +0 -29
  22. package/lib/Components/Ease/Entites/EaseEntity.d.ts +0 -21
  23. package/lib/Components/Ease/Entites/EaseEntity.js +0 -8
  24. package/lib/Components/Ease/index.d.ts +0 -2
  25. package/lib/Components/Ease/index.js +0 -14
  26. package/lib/Components/Landmarks/Controller/Mouse/MouseLandmark.d.ts +0 -22
  27. package/lib/Components/Landmarks/Controller/Mouse/MouseLandmark.js +0 -91
  28. package/lib/Components/Landmarks/Controller/Touch/TouchLandmark.d.ts +0 -20
  29. package/lib/Components/Landmarks/Controller/Touch/TouchLandmark.js +0 -84
  30. package/lib/Components/Landmarks/UseCases/SetOverlayColorUC.d.ts +0 -11
  31. package/lib/Components/Landmarks/UseCases/SetOverlayColorUC.js +0 -46
  32. package/lib/Components/Landmarks/UseCases/SetOverlayColorUndoRedo.d.ts +0 -12
  33. package/lib/Components/Landmarks/UseCases/SetOverlayColorUndoRedo.js +0 -37
  34. package/lib/Components/Tools/Factory/index.d.ts +0 -2
  35. package/lib/Components/Tools/Factory/index.js +0 -14
  36. package/lib/Components/Tools/Factory/setupTool.d.ts +0 -3
  37. package/lib/Components/Tools/Factory/setupTool.js +0 -12
  38. package/lib/Components/Tools/Factory/setupToolRepo.d.ts +0 -4
  39. package/lib/Components/Tools/Factory/setupToolRepo.js +0 -13
  40. package/lib/ValueObjects/Result.d.ts +0 -30
  41. package/lib/ValueObjects/Result.js +0 -45
@@ -3,7 +3,6 @@ export * from "./Babylon";
3
3
  export * from "./Camera";
4
4
  export * from "./ChannelModel";
5
5
  export * from "./Dispatcher";
6
- export * from "./Ease";
7
6
  export * from "./Enablement";
8
7
  export * from "./FramedScreen";
9
8
  export * from "./Hideable";
@@ -15,7 +15,6 @@ __exportStar(require("./Babylon"), exports);
15
15
  __exportStar(require("./Camera"), exports);
16
16
  __exportStar(require("./ChannelModel"), exports);
17
17
  __exportStar(require("./Dispatcher"), exports);
18
- __exportStar(require("./Ease"), exports);
19
18
  __exportStar(require("./Enablement"), exports);
20
19
  __exportStar(require("./FramedScreen"), exports);
21
20
  __exportStar(require("./Hideable"), exports);
@@ -0,0 +1,19 @@
1
+ export declare function easeLinear(x: number): number;
2
+ export declare function quadIn(x: number): number;
3
+ export declare function quadOut(x: number): number;
4
+ export declare function quadInOut(x: number): number;
5
+ export declare function cubicIn(x: number): number;
6
+ export declare function cubicOut(x: number): number;
7
+ export declare function cubicInOut(x: number): number;
8
+ export declare function expoIn(x: number): number;
9
+ export declare function expoOut(x: number): number;
10
+ export declare function expoInOut(x: number): number;
11
+ export declare function sinIn(x: number): number;
12
+ export declare function sinOut(x: number): number;
13
+ export declare function sinInOut(x: number): number;
14
+ export declare function quartIn(x: number): number;
15
+ export declare function quartOut(x: number): number;
16
+ export declare function quartInOut(x: number): number;
17
+ export declare function quintIn(x: number): number;
18
+ export declare function quintOut(x: number): number;
19
+ export declare function quintInOut(x: number): number;
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.quintInOut = exports.quintOut = exports.quintIn = exports.quartInOut = exports.quartOut = exports.quartIn = exports.sinInOut = exports.sinOut = exports.sinIn = exports.expoInOut = exports.expoOut = exports.expoIn = exports.cubicInOut = exports.cubicOut = exports.cubicIn = exports.quadInOut = exports.quadOut = exports.quadIn = exports.easeLinear = void 0;
4
+ function easeLinear(x) {
5
+ if (x <= 0)
6
+ return 0;
7
+ if (x >= 1)
8
+ return 1;
9
+ return x;
10
+ }
11
+ exports.easeLinear = easeLinear;
12
+ function quadIn(x) {
13
+ if (x <= 0)
14
+ return 0;
15
+ if (x >= 1)
16
+ return 1;
17
+ return x * x;
18
+ }
19
+ exports.quadIn = quadIn;
20
+ function quadOut(x) {
21
+ if (x <= 0)
22
+ return 0;
23
+ if (x >= 1)
24
+ return 1;
25
+ return x * (2 - x);
26
+ }
27
+ exports.quadOut = quadOut;
28
+ function quadInOut(x) {
29
+ if (x <= 0)
30
+ return 0;
31
+ if (x >= 1)
32
+ return 1;
33
+ if (x < 0.5) {
34
+ return 2 * x * x;
35
+ }
36
+ else {
37
+ return 1 - Math.pow(-2 * x + 2, 2) / 2;
38
+ }
39
+ }
40
+ exports.quadInOut = quadInOut;
41
+ function cubicIn(x) {
42
+ if (x <= 0)
43
+ return 0;
44
+ if (x >= 1)
45
+ return 1;
46
+ return x * x * x;
47
+ }
48
+ exports.cubicIn = cubicIn;
49
+ function cubicOut(x) {
50
+ if (x <= 0)
51
+ return 0;
52
+ if (x >= 1)
53
+ return 1;
54
+ return --x * x * x + 1;
55
+ }
56
+ exports.cubicOut = cubicOut;
57
+ function cubicInOut(x) {
58
+ if (x <= 0)
59
+ return 0;
60
+ if (x >= 1)
61
+ return 1;
62
+ x *= 2;
63
+ if (x <= 1) {
64
+ return (x * x * x) / 2;
65
+ }
66
+ else {
67
+ return ((x -= 2) * x * x + 2) / 2;
68
+ }
69
+ }
70
+ exports.cubicInOut = cubicInOut;
71
+ function expoIn(x) {
72
+ if (x <= 0)
73
+ return 0;
74
+ if (x >= 1)
75
+ return 1;
76
+ return Math.pow(2, 10 * x - 10);
77
+ }
78
+ exports.expoIn = expoIn;
79
+ function expoOut(x) {
80
+ if (x <= 0)
81
+ return 0;
82
+ if (x >= 1)
83
+ return 1;
84
+ return 1 - Math.pow(2, -10 * x);
85
+ }
86
+ exports.expoOut = expoOut;
87
+ function expoInOut(x) {
88
+ if (x <= 0)
89
+ return 0;
90
+ if (x >= 1)
91
+ return 1;
92
+ return x < 0.5
93
+ ? Math.pow(2, 20 * x - 10) / 2
94
+ : (2 - Math.pow(2, -20 * x + 10)) / 2;
95
+ }
96
+ exports.expoInOut = expoInOut;
97
+ function sinIn(x) {
98
+ if (x <= 0)
99
+ return 0;
100
+ if (x >= 1)
101
+ return 1;
102
+ return 1 - Math.cos((x * Math.PI) / 2);
103
+ }
104
+ exports.sinIn = sinIn;
105
+ function sinOut(x) {
106
+ if (x <= 0)
107
+ return 0;
108
+ if (x >= 1)
109
+ return 1;
110
+ return Math.sin((x * Math.PI) / 2);
111
+ }
112
+ exports.sinOut = sinOut;
113
+ function sinInOut(x) {
114
+ if (x <= 0)
115
+ return 0;
116
+ if (x >= 1)
117
+ return 1;
118
+ return -(Math.cos(Math.PI * x) - 1) / 2;
119
+ }
120
+ exports.sinInOut = sinInOut;
121
+ function quartIn(x) {
122
+ if (x <= 0)
123
+ return 0;
124
+ if (x >= 1)
125
+ return 1;
126
+ return x * x * x * x;
127
+ }
128
+ exports.quartIn = quartIn;
129
+ function quartOut(x) {
130
+ if (x <= 0)
131
+ return 0;
132
+ if (x >= 1)
133
+ return 1;
134
+ return 1 - Math.pow(1 - x, 4);
135
+ }
136
+ exports.quartOut = quartOut;
137
+ function quartInOut(x) {
138
+ if (x <= 0)
139
+ return 0;
140
+ if (x >= 1)
141
+ return 1;
142
+ if (x < 0.5) {
143
+ return 8 * x * x * x * x;
144
+ }
145
+ else {
146
+ return 1 - Math.pow(-2 * x + 2, 4) / 2;
147
+ }
148
+ }
149
+ exports.quartInOut = quartInOut;
150
+ function quintIn(x) {
151
+ if (x <= 0)
152
+ return 0;
153
+ if (x >= 1)
154
+ return 1;
155
+ return x * x * x * x * x;
156
+ }
157
+ exports.quintIn = quintIn;
158
+ function quintOut(x) {
159
+ if (x <= 0)
160
+ return 0;
161
+ if (x >= 1)
162
+ return 1;
163
+ return 1 - Math.pow(1 - x, 5);
164
+ }
165
+ exports.quintOut = quintOut;
166
+ function quintInOut(x) {
167
+ if (x <= 0)
168
+ return 0;
169
+ if (x >= 1)
170
+ return 1;
171
+ if (x < 0.5) {
172
+ return 16 * x * x * x * x * x;
173
+ }
174
+ else {
175
+ return 1 - Math.pow(-2 * x + 2, 5) / 2;
176
+ }
177
+ }
178
+ exports.quintInOut = quintInOut;
@@ -1,3 +1,4 @@
1
1
  export * from "./degreesToRadians";
2
2
  export * from "./LengthConverters";
3
3
  export * from "./generateUniqueID";
4
+ export * from "./easeFunctions";
@@ -13,3 +13,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./degreesToRadians"), exports);
14
14
  __exportStar(require("./LengthConverters"), exports);
15
15
  __exportStar(require("./generateUniqueID"), exports);
16
+ __exportStar(require("./easeFunctions"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vived/app",
3
- "version": "4.8.0",
3
+ "version": "4.8.2",
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,2 +0,0 @@
1
- import { AppObjectRepo } from "../../../AppObject/AppObjectRepo";
2
- export declare function submitError(sender: string, message: string, appObjects: AppObjectRepo, showAlert?: boolean): void;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.submitError = void 0;
4
- const Dispatcher_1 = require("../../Dispatcher");
5
- const LogUC_1 = require("../../Dispatcher/UC/LogUC");
6
- function submitError(sender, message, appObjects, showAlert = true) {
7
- const logUC = LogUC_1.LogUC.get(appObjects);
8
- if (logUC) {
9
- logUC.error(sender, message);
10
- }
11
- else {
12
- console.error(`[${sender}]: ${message}`);
13
- }
14
- if (!showAlert)
15
- return;
16
- const alert = Dispatcher_1.ShowAlertUC.get(appObjects);
17
- if (!alert)
18
- return;
19
- alert.showAlert({
20
- title: "Error",
21
- closeButtonLabel: "Close",
22
- closeCallback: () => {
23
- // done
24
- },
25
- message: `[${sender}]: ${message}`
26
- });
27
- }
28
- exports.submitError = submitError;
@@ -1,2 +0,0 @@
1
- import { AppObjectRepo } from "../../../AppObject/AppObjectRepo";
2
- export declare function submitFatal(sender: string, message: string, appObjects: AppObjectRepo, showAlert?: boolean): void;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.submitFatal = void 0;
4
- const Dispatcher_1 = require("../../Dispatcher");
5
- const LogUC_1 = require("../../Dispatcher/UC/LogUC");
6
- function submitFatal(sender, message, appObjects, showAlert = true) {
7
- const logUC = LogUC_1.LogUC.get(appObjects);
8
- if (logUC) {
9
- logUC.fatal(sender, message);
10
- }
11
- else {
12
- console.error(`[${sender}]: ${message}`);
13
- }
14
- if (!showAlert)
15
- return;
16
- const alert = Dispatcher_1.ShowAlertUC.get(appObjects);
17
- if (!alert)
18
- return;
19
- alert.showAlert({
20
- title: "Fatal Error",
21
- closeButtonLabel: "Close",
22
- closeCallback: () => {
23
- // done
24
- },
25
- message: `[${sender}]: ${message}`
26
- });
27
- }
28
- exports.submitFatal = submitFatal;
@@ -1,2 +0,0 @@
1
- import { AppObjectRepo } from "../../../AppObject/AppObjectRepo";
2
- export declare function submitLog(sender: string, message: string, appObjects: AppObjectRepo, showAlert?: boolean): void;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.submitLog = void 0;
4
- const Dispatcher_1 = require("../../Dispatcher");
5
- const LogUC_1 = require("../../Dispatcher/UC/LogUC");
6
- function submitLog(sender, message, appObjects, showAlert = false) {
7
- const logUC = LogUC_1.LogUC.get(appObjects);
8
- if (logUC) {
9
- logUC.log(sender, message);
10
- }
11
- else {
12
- console.log(`[${sender}]: ${message}`);
13
- }
14
- if (!showAlert)
15
- return;
16
- const alert = Dispatcher_1.ShowAlertUC.get(appObjects);
17
- if (!alert)
18
- return;
19
- alert.showAlert({
20
- title: "Log",
21
- closeButtonLabel: "Close",
22
- closeCallback: () => {
23
- // done
24
- },
25
- message: `[${sender}]: ${message}`
26
- });
27
- }
28
- exports.submitLog = submitLog;
@@ -1,2 +0,0 @@
1
- import { AppObjectRepo } from "../../../AppObject/AppObjectRepo";
2
- export declare function submitWarning(sender: string, message: string, appObjects: AppObjectRepo, showAlert?: boolean): void;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.submitWarning = void 0;
4
- const Dispatcher_1 = require("../../Dispatcher");
5
- const LogUC_1 = require("../../Dispatcher/UC/LogUC");
6
- function submitWarning(sender, message, appObjects, showAlert = false) {
7
- const logUC = LogUC_1.LogUC.get(appObjects);
8
- if (logUC) {
9
- logUC.warn(sender, message);
10
- }
11
- else {
12
- console.warn(`[${sender}]: ${message}`);
13
- }
14
- if (!showAlert)
15
- return;
16
- const alert = Dispatcher_1.ShowAlertUC.get(appObjects);
17
- if (!alert)
18
- return;
19
- alert.showAlert({
20
- title: "Warning",
21
- closeButtonLabel: "Close",
22
- closeCallback: () => {
23
- // done
24
- },
25
- message: `[${sender}]: ${message}`
26
- });
27
- }
28
- exports.submitWarning = submitWarning;
@@ -1,4 +0,0 @@
1
- import { AppObject } from "@vived/app";
2
- import { EntityContext } from "Entities/EntityContext";
3
- import { CameraFactory } from "../Entities/CameraFactory";
4
- export declare function makeCameraFactory(appObject: AppObject, entities: EntityContext): CameraFactory;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeCameraFactory = void 0;
4
- const AppObjectComponents_1 = require("@vived/app/lib/AppObjectComponents");
5
- const CameraEntity_1 = require("../Entities/CameraEntity");
6
- const CameraFactory_1 = require("../Entities/CameraFactory");
7
- const CameraPM_1 = require("../PM/CameraPM");
8
- function makeCameraFactory(appObject, entities) {
9
- return new CameraFactoryImp(appObject, entities);
10
- }
11
- exports.makeCameraFactory = makeCameraFactory;
12
- class CameraFactoryImp extends CameraFactory_1.CameraFactory {
13
- constructor(appObject, entities) {
14
- super(appObject, CameraFactory_1.CameraFactory.type);
15
- this.entities = entities;
16
- this.setupCamera = () => {
17
- const appObjects = this.entities.appObjects;
18
- const cameraEntityAo = appObjects.getOrCreate(CameraFactory_1.CameraFactory.entityAppObjectId);
19
- new AppObjectComponents_1.Transform3D(cameraEntityAo);
20
- const cameraEntity = CameraEntity_1.makeCameraEntity(cameraEntityAo);
21
- CameraPM_1.makeCameraPM(cameraEntityAo);
22
- return cameraEntity;
23
- };
24
- }
25
- }
@@ -1,10 +0,0 @@
1
- /// <reference types="jest" />
2
- import { AppObject } from "../../../AppObject/AppObject";
3
- import { LogUC } from "../UC/LogUC";
4
- export declare class MockLogUC extends LogUC {
5
- log: jest.Mock<any, any>;
6
- warn: jest.Mock<any, any>;
7
- error: jest.Mock<any, any>;
8
- fatal: jest.Mock<any, any>;
9
- constructor(appObject: AppObject);
10
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MockLogUC = void 0;
4
- const LogUC_1 = require("../UC/LogUC");
5
- class MockLogUC extends LogUC_1.LogUC {
6
- constructor(appObject) {
7
- super(appObject, LogUC_1.LogUC.type);
8
- this.log = jest.fn();
9
- this.warn = jest.fn();
10
- this.error = jest.fn();
11
- this.fatal = jest.fn();
12
- }
13
- }
14
- exports.MockLogUC = MockLogUC;
@@ -1,22 +0,0 @@
1
- import { AppObject } from "../../../AppObject";
2
- import { EaseEntity } from "./EaseEntity";
3
- export declare class AllLinearEase extends EaseEntity {
4
- linearFn: (val: number) => number;
5
- linear: (val: number) => number;
6
- quadIn: (val: number) => number;
7
- quadOut: (val: number) => number;
8
- quadInOut: (val: number) => number;
9
- cubicIn: (val: number) => number;
10
- cubicOut: (val: number) => number;
11
- cubicInOut: (val: number) => number;
12
- sinIn: (val: number) => number;
13
- sinOut: (val: number) => number;
14
- sinInOut: (val: number) => number;
15
- expIn: (val: number) => number;
16
- expOut: (val: number) => number;
17
- expInOut: (val: number) => number;
18
- circleIn: (val: number) => number;
19
- circleOut: (val: number) => number;
20
- circleInOut: (val: number) => number;
21
- constructor(appObject: AppObject);
22
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AllLinearEase = void 0;
4
- const EaseEntity_1 = require("./EaseEntity");
5
- class AllLinearEase extends EaseEntity_1.EaseEntity {
6
- constructor(appObject) {
7
- super(appObject, EaseEntity_1.EaseEntity.type);
8
- this.linearFn = (val) => {
9
- return val;
10
- };
11
- this.linear = this.linearFn;
12
- this.quadIn = this.linearFn;
13
- this.quadOut = this.linearFn;
14
- this.quadInOut = this.linearFn;
15
- this.cubicIn = this.linearFn;
16
- this.cubicOut = this.linearFn;
17
- this.cubicInOut = this.linearFn;
18
- this.sinIn = this.linearFn;
19
- this.sinOut = this.linearFn;
20
- this.sinInOut = this.linearFn;
21
- this.expIn = this.linearFn;
22
- this.expOut = this.linearFn;
23
- this.expInOut = this.linearFn;
24
- this.circleIn = this.linearFn;
25
- this.circleOut = this.linearFn;
26
- this.circleInOut = this.linearFn;
27
- }
28
- }
29
- exports.AllLinearEase = AllLinearEase;
@@ -1,21 +0,0 @@
1
- import { AppObjectEntity } from "../../../AppObject";
2
- import { EaseFn } from "../../../Types";
3
- export declare abstract class EaseEntity extends AppObjectEntity {
4
- static type: string;
5
- abstract linear: EaseFn;
6
- abstract quadIn: EaseFn;
7
- abstract quadOut: EaseFn;
8
- abstract quadInOut: EaseFn;
9
- abstract cubicIn: EaseFn;
10
- abstract cubicOut: EaseFn;
11
- abstract cubicInOut: EaseFn;
12
- abstract sinIn: EaseFn;
13
- abstract sinOut: EaseFn;
14
- abstract sinInOut: EaseFn;
15
- abstract expIn: EaseFn;
16
- abstract expOut: EaseFn;
17
- abstract expInOut: EaseFn;
18
- abstract circleIn: EaseFn;
19
- abstract circleOut: EaseFn;
20
- abstract circleInOut: EaseFn;
21
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EaseEntity = void 0;
4
- const AppObject_1 = require("../../../AppObject");
5
- class EaseEntity extends AppObject_1.AppObjectEntity {
6
- }
7
- exports.EaseEntity = EaseEntity;
8
- EaseEntity.type = "EaseEntity";
@@ -1,2 +0,0 @@
1
- export * from "./Entites/EaseEntity";
2
- export * from "./Entites/AllLinearEase";
@@ -1,14 +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("./Entites/EaseEntity"), exports);
14
- __exportStar(require("./Entites/AllLinearEase"), exports);
@@ -1,22 +0,0 @@
1
- import { AppObject, AppObjectController } from "../../../../AppObject";
2
- import { MouseController, MouseInputEvent } from "../../../MouseInput";
3
- export declare abstract class MouseLandmark extends AppObjectController implements MouseController {
4
- static type: string;
5
- addingLandmark: boolean;
6
- pressed: boolean;
7
- abstract onMove: (e: MouseInputEvent) => void;
8
- abstract onDown: (e: MouseInputEvent) => void;
9
- }
10
- export declare function makeMouseLandmark(appObject: AppObject): MouseLandmarkImp;
11
- declare class MouseLandmarkImp extends MouseLandmark {
12
- addingLandmark: boolean;
13
- pressed: boolean;
14
- private tryPreviewLandmarkUc?;
15
- private tryAddLandmarkUc?;
16
- allow: (e: MouseInputEvent) => boolean;
17
- onMove: (e: MouseInputEvent) => void;
18
- onDown: (e: MouseInputEvent) => void;
19
- onUp: (e: MouseInputEvent) => void;
20
- constructor(appObject: AppObject);
21
- }
22
- export {};
@@ -1,91 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeMouseLandmark = exports.MouseLandmark = void 0;
4
- const AppObject_1 = require("../../../../AppObject");
5
- const Babylon_1 = require("../../../Babylon");
6
- const MouseInput_1 = require("../../../MouseInput");
7
- const LandmarkGlobals_1 = require("../../Entities/LandmarkGlobals");
8
- const TryAddNewLandmarkUC_1 = require("../../UseCases/TryAddNewLandmarkUC");
9
- const TryPreviewLandmarkUC_1 = require("../../UseCases/TryPreviewLandmarkUC");
10
- class MouseLandmark extends AppObject_1.AppObjectController {
11
- constructor() {
12
- super(...arguments);
13
- this.addingLandmark = false;
14
- this.pressed = false;
15
- }
16
- }
17
- exports.MouseLandmark = MouseLandmark;
18
- MouseLandmark.type = "Mouse_Landmark_Controller";
19
- function makeMouseLandmark(appObject) {
20
- return new MouseLandmarkImp(appObject);
21
- }
22
- exports.makeMouseLandmark = makeMouseLandmark;
23
- class MouseLandmarkImp extends MouseLandmark {
24
- constructor(appObject) {
25
- super(appObject, MouseLandmark.type);
26
- this.addingLandmark = false;
27
- this.pressed = false;
28
- this.allow = (e) => {
29
- return true;
30
- };
31
- this.onMove = (e) => {
32
- if (!this.allow(e))
33
- return;
34
- if (!this.tryPreviewLandmarkUc) {
35
- return;
36
- }
37
- const ray = Babylon_1.pixelToSceneRay(e.position, this.appObjects);
38
- this.tryPreviewLandmarkUc.tryPreviewLandmark(ray, this.pressed);
39
- };
40
- this.onDown = (e) => {
41
- this.addingLandmark = false;
42
- if (e.button !== 0)
43
- return;
44
- if (!this.allow(e))
45
- return;
46
- if (!this.tryPreviewLandmarkUc) {
47
- return;
48
- }
49
- const ray = Babylon_1.pixelToSceneRay(e.position, this.appObjects);
50
- const pressed = true;
51
- this.tryPreviewLandmarkUc.tryPreviewLandmark(ray, pressed);
52
- this.addingLandmark = true;
53
- this.pressed = true;
54
- };
55
- this.onUp = (e) => {
56
- var _a;
57
- if (!this.allow(e))
58
- return;
59
- if (!this.addingLandmark)
60
- return;
61
- if (!this.tryAddLandmarkUc)
62
- return;
63
- const landmarkPreview = (_a = this.appObject.getComponent(LandmarkGlobals_1.LandmarkGlobals.type)) === null || _a === void 0 ? void 0 : _a.previewLandmark;
64
- if (!landmarkPreview) {
65
- return;
66
- }
67
- const ray = Babylon_1.pixelToSceneRay(e.position, this.appObjects);
68
- this.tryAddLandmarkUc.addFromRay(ray);
69
- landmarkPreview.hideable.isHidden = true;
70
- this.addingLandmark = false;
71
- this.pressed = false;
72
- };
73
- this.tryPreviewLandmarkUc = TryPreviewLandmarkUC_1.TryPreviewLandmarkUC.get(appObject);
74
- if (!this.tryPreviewLandmarkUc) {
75
- this.warn("Unable to find TryPreviewLandmarkUC");
76
- return;
77
- }
78
- this.tryAddLandmarkUc = TryAddNewLandmarkUC_1.TryAddNewLandmarkUC.get(appObject);
79
- if (!this.tryAddLandmarkUc) {
80
- this.warn("Unable to find TryAddNewLandmarkUC");
81
- return;
82
- }
83
- const mouseInput = MouseInput_1.MouseInputEntity.get(this.appObjects);
84
- if (mouseInput) {
85
- mouseInput.registerController(this);
86
- }
87
- else {
88
- this.warn("Unable to find MouseInputEntity");
89
- }
90
- }
91
- }
@@ -1,20 +0,0 @@
1
- import { AppObject, AppObjectController } from "../../../../AppObject";
2
- import { TouchController, TouchInputEvent } from "../../../TouchController";
3
- export declare abstract class TouchLandmark extends AppObjectController implements TouchController {
4
- static type: string;
5
- abstract onTouchStart(e: TouchInputEvent): void;
6
- abstract onTouchMove(e: TouchInputEvent): void;
7
- abstract onTouchEnd(e: TouchInputEvent): void;
8
- }
9
- export declare function makeTouchLandmark(appObject: AppObject): TouchLandmarkImp;
10
- declare class TouchLandmarkImp extends TouchLandmark {
11
- private lastTouch;
12
- private tryPreviewLandmarkUc?;
13
- private tryAddLandmarkUc?;
14
- allow: (e: TouchInputEvent) => boolean;
15
- onTouchStart: (e: TouchInputEvent) => void;
16
- onTouchMove: (e: TouchInputEvent) => void;
17
- onTouchEnd: (e: TouchInputEvent) => void;
18
- constructor(appObject: AppObject);
19
- }
20
- export {};
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeTouchLandmark = exports.TouchLandmark = void 0;
4
- const AppObject_1 = require("../../../../AppObject");
5
- const ValueObjects_1 = require("../../../../ValueObjects");
6
- const Babylon_1 = require("../../../Babylon");
7
- const TouchController_1 = require("../../../TouchController");
8
- const LandmarkGlobals_1 = require("../../Entities/LandmarkGlobals");
9
- const TryAddNewLandmarkUC_1 = require("../../UseCases/TryAddNewLandmarkUC");
10
- const TryPreviewLandmarkUC_1 = require("../../UseCases/TryPreviewLandmarkUC");
11
- class TouchLandmark extends AppObject_1.AppObjectController {
12
- }
13
- exports.TouchLandmark = TouchLandmark;
14
- TouchLandmark.type = "TOUCH_LANDMARK_CONTROLLER";
15
- function makeTouchLandmark(appObject) {
16
- return new TouchLandmarkImp(appObject);
17
- }
18
- exports.makeTouchLandmark = makeTouchLandmark;
19
- class TouchLandmarkImp extends TouchLandmark {
20
- constructor(appObject) {
21
- super(appObject, TouchLandmark.type);
22
- this.lastTouch = ValueObjects_1.Vector2.Zero();
23
- this.allow = (e) => {
24
- return true;
25
- };
26
- this.onTouchStart = (e) => {
27
- if (!this.allow(e))
28
- return;
29
- if (e.touchCount > 1)
30
- return;
31
- if (!this.tryPreviewLandmarkUc)
32
- return;
33
- const position = e.touches[0].position;
34
- this.lastTouch = position;
35
- const ray = Babylon_1.pixelToSceneRay(position, this.appObjects);
36
- this.tryPreviewLandmarkUc.tryPreviewLandmark(ray, true);
37
- };
38
- this.onTouchMove = (e) => {
39
- if (!this.allow(e))
40
- return;
41
- if (e.touchCount > 1)
42
- return;
43
- if (!this.tryPreviewLandmarkUc)
44
- return;
45
- const position = e.touches[0].position;
46
- this.lastTouch = position;
47
- const ray = Babylon_1.pixelToSceneRay(position, this.appObjects);
48
- this.tryPreviewLandmarkUc.tryPreviewLandmark(ray, true);
49
- };
50
- this.onTouchEnd = (e) => {
51
- var _a;
52
- if (!this.allow(e))
53
- return;
54
- if (e.touchCount > 1)
55
- return;
56
- if (!this.tryAddLandmarkUc)
57
- return;
58
- const landmarkPreview = (_a = this.appObject.getComponent(LandmarkGlobals_1.LandmarkGlobals.type)) === null || _a === void 0 ? void 0 : _a.previewLandmark;
59
- if (!landmarkPreview) {
60
- return;
61
- }
62
- const ray = Babylon_1.pixelToSceneRay(this.lastTouch, this.appObjects);
63
- this.tryAddLandmarkUc.addFromRay(ray);
64
- landmarkPreview.hideable.isHidden = true;
65
- };
66
- this.tryPreviewLandmarkUc = TryPreviewLandmarkUC_1.TryPreviewLandmarkUC.get(appObject);
67
- if (!this.tryPreviewLandmarkUc) {
68
- this.warn("Unable to find TryPreviewLandmarkUC");
69
- return;
70
- }
71
- this.tryAddLandmarkUc = TryAddNewLandmarkUC_1.TryAddNewLandmarkUC.get(appObject);
72
- if (!this.tryAddLandmarkUc) {
73
- this.warn("Unable to find TryAddNewLandmarkUC");
74
- return;
75
- }
76
- const touchInput = TouchController_1.TouchInputEntity.get(this.appObjects);
77
- if (touchInput) {
78
- touchInput.registerController(this);
79
- }
80
- else {
81
- this.warn("Unable to find TouchInputEntity");
82
- }
83
- }
84
- }
@@ -1,11 +0,0 @@
1
- import { AppObject, AppObjectUC } from "../../../AppObject";
2
- import { OverlayColorEnums } from "../../OverlayColor";
3
- export declare class SetOverlayColorUC extends AppObjectUC {
4
- static readonly type = "SetOverlayColorUC";
5
- private overlayColor?;
6
- private landmarkGlobals?;
7
- setOverlayColor: (color: OverlayColorEnums) => void;
8
- dispose: () => void;
9
- constructor(appObject: AppObject);
10
- static get(appObj: AppObject): SetOverlayColorUC | undefined;
11
- }
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SetOverlayColorUC = void 0;
4
- const AppObject_1 = require("../../../AppObject");
5
- const Dispatcher_1 = require("../../Dispatcher");
6
- const OverlayColor_1 = require("../../OverlayColor");
7
- const LandmarkGlobals_1 = require("../Entities/LandmarkGlobals");
8
- const SetOverlayColorUndoRedo_1 = require("./SetOverlayColorUndoRedo");
9
- class SetOverlayColorUC extends AppObject_1.AppObjectUC {
10
- constructor(appObject) {
11
- super(appObject, SetOverlayColorUC.type);
12
- this.setOverlayColor = (color) => {
13
- if (!this.overlayColor)
14
- return;
15
- if (!this.landmarkGlobals)
16
- return;
17
- if (this.overlayColor.overlayColor === color)
18
- return;
19
- const prevColor = this.overlayColor.overlayColor;
20
- this.overlayColor.overlayColor = color;
21
- Dispatcher_1.dispatchStateChange(this.appObjects);
22
- new SetOverlayColorUndoRedo_1.SetOverlayColorUndoRedo(color, prevColor, this.appObject);
23
- this.landmarkGlobals.lastColor = color;
24
- };
25
- this.dispose = () => {
26
- var _a;
27
- super.dispose();
28
- (_a = this.overlayColor) === null || _a === void 0 ? void 0 : _a.removeOnDisposeObserver(this.dispose);
29
- };
30
- this.landmarkGlobals = LandmarkGlobals_1.LandmarkGlobals.get(this.appObjects);
31
- if (!this.landmarkGlobals) {
32
- this.warn("SetOverlayColorUC has been added to an App Object but LandmarkGlobals Entity was not added. Add a LandmarkGlobals Entity");
33
- return;
34
- }
35
- this.overlayColor = appObject.getComponent(OverlayColor_1.OverlayColor.type);
36
- if (!this.overlayColor) {
37
- this.warn("SetOverlayColorUC has been added to an App Object that does not have a Overlay Color Entity. Add a Overlay Color Entity before adding the UC");
38
- return;
39
- }
40
- }
41
- static get(appObj) {
42
- return appObj.getComponent(this.type);
43
- }
44
- }
45
- exports.SetOverlayColorUC = SetOverlayColorUC;
46
- SetOverlayColorUC.type = "SetOverlayColorUC";
@@ -1,12 +0,0 @@
1
- import { AppObject } from "../../../AppObject";
2
- import { OverlayColorEnums } from "../../OverlayColor";
3
- import { UndoRedoAction } from "../../UndoRedo/Entities/UndoRedoEntity";
4
- export declare class SetOverlayColorUndoRedo implements UndoRedoAction {
5
- private color;
6
- private preColor;
7
- private appObject;
8
- private overlayColor?;
9
- undoAction: () => void;
10
- redoAction: () => void;
11
- constructor(color: OverlayColorEnums, preColor: OverlayColorEnums, appObject: AppObject);
12
- }
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SetOverlayColorUndoRedo = void 0;
4
- const DispatchStateChangeUC_1 = require("../../Dispatcher/UC/DispatchStateChangeUC");
5
- const OverlayColor_1 = require("../../OverlayColor");
6
- const UndoRedoEntity_1 = require("../../UndoRedo/Entities/UndoRedoEntity");
7
- class SetOverlayColorUndoRedo {
8
- constructor(color, preColor, appObject) {
9
- this.color = color;
10
- this.preColor = preColor;
11
- this.appObject = appObject;
12
- this.undoAction = () => {
13
- if (!this.overlayColor)
14
- return;
15
- this.overlayColor.overlayColor = this.preColor;
16
- DispatchStateChangeUC_1.dispatchStateChange(this.appObject.appObjectRepo);
17
- };
18
- this.redoAction = () => {
19
- if (!this.overlayColor)
20
- return;
21
- this.overlayColor.overlayColor = this.color;
22
- DispatchStateChangeUC_1.dispatchStateChange(this.appObject.appObjectRepo);
23
- };
24
- this.overlayColor = OverlayColor_1.OverlayColor.get(this.appObject);
25
- if (!this.overlayColor) {
26
- appObject.appObjectRepo.submitWarning("SetOverlayColorUndoRedo", "Unable to find OverlayColorEntity");
27
- return;
28
- }
29
- const undoRedo = UndoRedoEntity_1.UndoRedoEntity.get(appObject.appObjectRepo);
30
- if (!undoRedo) {
31
- appObject.appObjectRepo.submitWarning("SetOverlayColorUndoRedo", "Unable to find UndoRedoEntity");
32
- return;
33
- }
34
- undoRedo.submitAction(this);
35
- }
36
- }
37
- exports.SetOverlayColorUndoRedo = SetOverlayColorUndoRedo;
@@ -1,2 +0,0 @@
1
- export * from "./setupTool";
2
- export * from "./setupToolRepo";
@@ -1,14 +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("./setupTool"), exports);
14
- __exportStar(require("./setupToolRepo"), exports);
@@ -1,3 +0,0 @@
1
- import { AppObjectRepo } from "../../../AppObject/AppObjectRepo";
2
- import { ToolData, ToolEntity } from "../Entities/ToolEntity";
3
- export declare function setupTool<ToolTypes>(toolData: ToolData<ToolTypes>, appObjects: AppObjectRepo): ToolEntity<ToolTypes>;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupTool = void 0;
4
- const ToolEntity_1 = require("../Entities/ToolEntity");
5
- const ToolPM_1 = require("../PM/ToolPM");
6
- function setupTool(toolData, appObjects) {
7
- const tool = appObjects.getOrCreate(toolData.label);
8
- const toolEntity = ToolEntity_1.makeToolEntity(toolData, tool);
9
- const pm = new ToolPM_1.ToolPM(tool);
10
- return toolEntity;
11
- }
12
- exports.setupTool = setupTool;
@@ -1,4 +0,0 @@
1
- import { AppObjectRepo } from "../../../AppObject/AppObjectRepo";
2
- import { ToolData } from "../Entities/ToolEntity";
3
- import { ToolRepository } from "../Entities/ToolRepository";
4
- export declare function setupToolRepo<ToolTypes>(data: ToolData<ToolTypes>[], appObjects: AppObjectRepo): ToolRepository<ToolTypes>;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupToolRepo = void 0;
4
- const ToolHotkeys_1 = require("../Controller/ToolHotkeys");
5
- const ToolRepository_1 = require("../Entities/ToolRepository");
6
- function setupToolRepo(data, appObjects) {
7
- const toolRepo = appObjects.getOrCreate("ToolRepo");
8
- const entity = ToolRepository_1.makeToolRepo(toolRepo);
9
- entity.setupToolsFromData(data);
10
- new ToolHotkeys_1.ToolHotkeys(toolRepo);
11
- return entity;
12
- }
13
- exports.setupToolRepo = setupToolRepo;
@@ -1,30 +0,0 @@
1
- export declare type Result<T, E> = Resolved<T, E> | Rejected<T, E>;
2
- export declare const resolve: <T, E = never>(value: T) => Resolved<T, E>;
3
- export declare const reject: <T = never, E = unknown>(err: E) => Rejected<T, E>;
4
- interface IResult<T, E> {
5
- isResolved: boolean;
6
- isRejected: boolean;
7
- value?: T;
8
- error?: E;
9
- then<A>(f: (t: T) => A): Result<A, E>;
10
- catch<U>(f: (e: E) => U): Result<T, U>;
11
- }
12
- export declare class Rejected<T, E> implements IResult<T, E> {
13
- readonly error: E;
14
- readonly value: undefined;
15
- get isResolved(): boolean;
16
- get isRejected(): boolean;
17
- then<A>(_f: (t: T) => A): Result<A, E>;
18
- catch<U>(f: (e: E) => U): Result<T, U>;
19
- constructor(error: E);
20
- }
21
- export declare class Resolved<T, E> implements IResult<T, E> {
22
- readonly value: T;
23
- readonly error: undefined;
24
- get isResolved(): boolean;
25
- get isRejected(): boolean;
26
- then<A>(f: (t: T) => A): Result<A, E>;
27
- catch<U>(_f: (e: E) => U): Result<T, U>;
28
- constructor(value: T);
29
- }
30
- export {};
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Resolved = exports.Rejected = exports.reject = exports.resolve = void 0;
4
- const resolve = (value) => new Resolved(value);
5
- exports.resolve = resolve;
6
- const reject = (err) => new Rejected(err);
7
- exports.reject = reject;
8
- class Rejected {
9
- constructor(error) {
10
- this.value = undefined;
11
- this.error = error;
12
- }
13
- get isResolved() {
14
- return false;
15
- }
16
- get isRejected() {
17
- return true;
18
- }
19
- then(_f) {
20
- return exports.reject(this.error);
21
- }
22
- catch(f) {
23
- return exports.reject(f(this.error));
24
- }
25
- }
26
- exports.Rejected = Rejected;
27
- class Resolved {
28
- constructor(value) {
29
- this.error = undefined;
30
- this.value = value;
31
- }
32
- get isResolved() {
33
- return true;
34
- }
35
- get isRejected() {
36
- return false;
37
- }
38
- then(f) {
39
- return exports.resolve(f(this.value));
40
- }
41
- catch(_f) {
42
- return exports.resolve(this.value);
43
- }
44
- }
45
- exports.Resolved = Resolved;