@vived/app 4.13.0 → 4.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/lib/Components/Babylon/Mocks/MockBabylonRenderingUC.d.ts +2 -3
  2. package/lib/Components/Babylon/Mocks/MockBabylonRenderingUC.js +3 -3
  3. package/lib/Components/Babylon/Mocks/MockPixelToSceneRayUC.d.ts +1 -1
  4. package/lib/Components/Babylon/Mocks/MockPixelToSceneRayUC.js +3 -3
  5. package/lib/Components/Babylon/Mocks/MockSceneRayPickUC.d.ts +1 -1
  6. package/lib/Components/Babylon/Mocks/MockSceneRayPickUC.js +3 -3
  7. package/lib/Components/Babylon/UC/BabylonRenderingUC.d.ts +0 -9
  8. package/lib/Components/Babylon/UC/BabylonRenderingUC.js +1 -14
  9. package/lib/Components/Babylon/UC/PixelToSceneRayUC.d.ts +0 -7
  10. package/lib/Components/Babylon/UC/PixelToSceneRayUC.js +1 -12
  11. package/lib/Components/Babylon/UC/ScenePixelPickUC.d.ts +0 -7
  12. package/lib/Components/Babylon/UC/ScenePixelPickUC.js +1 -12
  13. package/lib/Components/Babylon/UC/SceneRayPickUC.d.ts +0 -7
  14. package/lib/Components/Babylon/UC/SceneRayPickUC.js +1 -12
  15. package/lib/Components/Babylon/index.d.ts +1 -0
  16. package/lib/Components/Babylon/index.js +1 -0
  17. package/lib/Components/Question/Entities/QuestionAnswerEntity.d.ts +0 -1
  18. package/lib/Components/Question/Entities/QuestionAnswerEntity.js +2 -6
  19. package/lib/Components/Transform3D/Controllers/Mouse/DragScaleTransformMC.d.ts +12 -0
  20. package/lib/Components/Transform3D/Controllers/Mouse/DragScaleTransformMC.js +49 -0
  21. package/lib/Components/Transform3D/Controllers/Mouse/PanTransformMC.d.ts +12 -0
  22. package/lib/Components/Transform3D/Controllers/Mouse/PanTransformMC.js +48 -0
  23. package/lib/Components/Transform3D/Controllers/Mouse/RollScaleTransformMC.d.ts +9 -0
  24. package/lib/Components/Transform3D/Controllers/Mouse/RollScaleTransformMC.js +37 -0
  25. package/lib/Components/Transform3D/Controllers/Mouse/index.d.ts +3 -0
  26. package/lib/Components/Transform3D/Controllers/Mouse/index.js +15 -0
  27. package/lib/Components/Transform3D/Controllers/Stylus/PanScaleTransformSC.d.ts +13 -0
  28. package/lib/Components/Transform3D/Controllers/Stylus/PanScaleTransformSC.js +54 -0
  29. package/lib/Components/Transform3D/Controllers/Stylus/PanTransformSC.d.ts +13 -0
  30. package/lib/Components/Transform3D/Controllers/Stylus/PanTransformSC.js +54 -0
  31. package/lib/Components/Transform3D/Controllers/Stylus/ScaleTransformSC.d.ts +13 -0
  32. package/lib/Components/Transform3D/Controllers/Stylus/ScaleTransformSC.js +54 -0
  33. package/lib/Components/Transform3D/Controllers/Stylus/index.d.ts +3 -0
  34. package/lib/Components/Transform3D/Controllers/Stylus/index.js +15 -0
  35. package/lib/Components/Transform3D/Controllers/Touch/DragScaleTransformTC.d.ts +13 -0
  36. package/lib/Components/Transform3D/Controllers/Touch/DragScaleTransformTC.js +60 -0
  37. package/lib/Components/Transform3D/Controllers/Touch/PanTransformTC.d.ts +12 -0
  38. package/lib/Components/Transform3D/Controllers/Touch/PanTransformTC.js +52 -0
  39. package/lib/Components/Transform3D/Controllers/Touch/PinchTransformTC.d.ts +13 -0
  40. package/lib/Components/Transform3D/Controllers/Touch/PinchTransformTC.js +55 -0
  41. package/lib/Components/Transform3D/Controllers/Touch/index.d.ts +3 -0
  42. package/lib/Components/Transform3D/Controllers/Touch/index.js +15 -0
  43. package/lib/Components/Transform3D/Controllers/index.d.ts +3 -0
  44. package/lib/Components/Transform3D/Controllers/index.js +15 -0
  45. package/lib/Components/Transform3D/Mocks/MockBumpTransformScaleAboutPixelPoint.d.ts +14 -0
  46. package/lib/Components/Transform3D/Mocks/MockBumpTransformScaleAboutPixelPoint.js +14 -0
  47. package/lib/Components/Transform3D/Mocks/MockPanTransformUC.d.ts +18 -0
  48. package/lib/Components/Transform3D/Mocks/MockPanTransformUC.js +18 -0
  49. package/lib/Components/Transform3D/Mocks/MockPinchTransformUC.d.ts +15 -0
  50. package/lib/Components/Transform3D/Mocks/MockPinchTransformUC.js +15 -0
  51. package/lib/Components/Transform3D/Mocks/MockRayPanScaleTransformUC.d.ts +19 -0
  52. package/lib/Components/Transform3D/Mocks/MockRayPanScaleTransformUC.js +15 -0
  53. package/lib/Components/Transform3D/Mocks/MockRayScaleTransform.d.ts +18 -0
  54. package/lib/Components/Transform3D/Mocks/MockRayScaleTransform.js +18 -0
  55. package/lib/Components/Transform3D/Mocks/index.d.ts +5 -0
  56. package/lib/Components/Transform3D/Mocks/index.js +17 -0
  57. package/lib/Components/Transform3D/UC/BumpTransformScaleAboutPixelPoint.d.ts +13 -0
  58. package/lib/Components/Transform3D/UC/BumpTransformScaleAboutPixelPoint.js +73 -0
  59. package/lib/Components/Transform3D/UC/PanTransformUC.d.ts +18 -0
  60. package/lib/Components/Transform3D/UC/PanTransformUC.js +94 -0
  61. package/lib/Components/Transform3D/UC/PinchTransform.d.ts +14 -0
  62. package/lib/Components/Transform3D/UC/PinchTransform.js +95 -0
  63. package/lib/Components/Transform3D/UC/RayPanScaleTransform.d.ts +18 -0
  64. package/lib/Components/Transform3D/UC/RayPanScaleTransform.js +113 -0
  65. package/lib/Components/Transform3D/UC/ScaleTransform.d.ts +17 -0
  66. package/lib/Components/Transform3D/UC/ScaleTransform.js +108 -0
  67. package/lib/Components/Transform3D/UC/index.d.ts +6 -0
  68. package/lib/Components/Transform3D/UC/index.js +6 -0
  69. package/lib/Components/Transform3D/index.d.ts +2 -0
  70. package/lib/Components/Transform3D/index.js +2 -0
  71. package/package.json +1 -1
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScaleTransformSC = void 0;
4
+ const AppObject_1 = require("../../../../AppObject");
5
+ const Stylus_1 = require("../../../Stylus");
6
+ const UC_1 = require("../../UC");
7
+ class ScaleTransformSC extends AppObject_1.AppObjectController {
8
+ constructor(appObject) {
9
+ super(appObject, ScaleTransformSC.type);
10
+ this.doUpdate = false;
11
+ this.allow = (button) => {
12
+ if (button === 0)
13
+ return true;
14
+ return false;
15
+ };
16
+ this.onButtonDown = (button) => {
17
+ this.doUpdate = false;
18
+ if (!this.stylus || !this.uc)
19
+ return;
20
+ if (!this.allow(button))
21
+ return;
22
+ this.uc.initializeRay(this.stylus.pickRay);
23
+ this.doUpdate = true;
24
+ };
25
+ this.onButtonUp = () => {
26
+ if (!this.doUpdate)
27
+ return;
28
+ this.doUpdate = false;
29
+ if (!this.uc)
30
+ return;
31
+ this.uc.finish();
32
+ };
33
+ this.onStylusMove = () => {
34
+ if (!this.stylus || !this.uc)
35
+ return;
36
+ if (!this.doUpdate)
37
+ return;
38
+ this.uc.updateRay(this.stylus.pickRay);
39
+ };
40
+ this.stylus = Stylus_1.StylusEntity.get(this.appObjects);
41
+ if (!this.stylus) {
42
+ this.error("Unable to find StylusEntity");
43
+ return;
44
+ }
45
+ this.uc = appObject.getComponent(UC_1.ScaleTransformUC.type);
46
+ if (!this.uc) {
47
+ this.error("App Object that does not have a RayScaleTransformUC");
48
+ return;
49
+ }
50
+ this.stylus.registerController(this);
51
+ }
52
+ }
53
+ exports.ScaleTransformSC = ScaleTransformSC;
54
+ ScaleTransformSC.type = "ScaleTransformSC";
@@ -0,0 +1,3 @@
1
+ export * from "./PanScaleTransformSC";
2
+ export * from "./PanTransformSC";
3
+ export * from "./ScaleTransformSC";
@@ -0,0 +1,15 @@
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("./PanScaleTransformSC"), exports);
14
+ __exportStar(require("./PanTransformSC"), exports);
15
+ __exportStar(require("./ScaleTransformSC"), exports);
@@ -0,0 +1,13 @@
1
+ import { AppObject, AppObjectController } from "../../../../AppObject";
2
+ import { TouchController, TouchInputEvent } from "../../../TouchController";
3
+ import { ScaleTransformUC } from "../../UC";
4
+ export declare class DragScaleTransformTC extends AppObjectController implements TouchController {
5
+ static readonly type = "DragScaleTransformTC";
6
+ private isScaling;
7
+ scaleUC?: ScaleTransformUC;
8
+ allow: (e: TouchInputEvent) => boolean;
9
+ onTouchStart: (e: TouchInputEvent) => void;
10
+ onTouchMove: (e: TouchInputEvent) => void;
11
+ onTouchEnd: () => void;
12
+ constructor(appObject: AppObject);
13
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DragScaleTransformTC = void 0;
4
+ const AppObject_1 = require("../../../../AppObject");
5
+ const TouchController_1 = require("../../../TouchController");
6
+ const UC_1 = require("../../UC");
7
+ class DragScaleTransformTC extends AppObject_1.AppObjectController {
8
+ constructor(appObject) {
9
+ super(appObject, DragScaleTransformTC.type);
10
+ this.isScaling = false;
11
+ this.allow = (e) => {
12
+ if (e.touches.length !== 1) {
13
+ return false;
14
+ }
15
+ return true;
16
+ };
17
+ this.onTouchStart = (e) => {
18
+ var _a;
19
+ this.isScaling = false;
20
+ if (e.touches.length !== 1) {
21
+ return;
22
+ }
23
+ if (!this.allow(e)) {
24
+ return;
25
+ }
26
+ const pixelPosition = e.touches[0].position;
27
+ (_a = this.scaleUC) === null || _a === void 0 ? void 0 : _a.initializePixel(pixelPosition);
28
+ this.isScaling = true;
29
+ };
30
+ this.onTouchMove = (e) => {
31
+ var _a;
32
+ if (!this.isScaling)
33
+ return;
34
+ if (e.touches.length !== 1)
35
+ return;
36
+ const pixelPosition = e.touches[0].position;
37
+ (_a = this.scaleUC) === null || _a === void 0 ? void 0 : _a.updatePixel(pixelPosition);
38
+ };
39
+ this.onTouchEnd = () => {
40
+ var _a;
41
+ this.isScaling = false;
42
+ (_a = this.scaleUC) === null || _a === void 0 ? void 0 : _a.finish();
43
+ };
44
+ const appObjects = appObject.appObjectRepo;
45
+ this.scaleUC = appObject.getComponent(UC_1.ScaleTransformUC.type);
46
+ if (!this.scaleUC) {
47
+ this.error("App Object that does not have ScaleTransformUC");
48
+ return;
49
+ }
50
+ const touchInput = TouchController_1.TouchInputEntity.get(appObjects);
51
+ if (touchInput) {
52
+ touchInput.registerController(this);
53
+ }
54
+ else {
55
+ this.warn("Unable to find TouchInputEntity");
56
+ }
57
+ }
58
+ }
59
+ exports.DragScaleTransformTC = DragScaleTransformTC;
60
+ DragScaleTransformTC.type = "DragScaleTransformTC";
@@ -0,0 +1,12 @@
1
+ import { AppObject, AppObjectController } from "../../../../AppObject";
2
+ import { TouchController, TouchInputEvent } from "../../../TouchController";
3
+ export declare class PanTransformTC extends AppObjectController implements TouchController {
4
+ static readonly type = "PanTransformTC";
5
+ private isPanning;
6
+ private panUC?;
7
+ allow: (e: TouchInputEvent) => boolean;
8
+ onTouchStart: (e: TouchInputEvent) => void;
9
+ onTouchMove: (e: TouchInputEvent) => void;
10
+ onTouchEnd: (e: TouchInputEvent) => void;
11
+ constructor(appObject: AppObject);
12
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PanTransformTC = void 0;
4
+ const AppObject_1 = require("../../../../AppObject");
5
+ const TouchController_1 = require("../../../TouchController");
6
+ const UC_1 = require("../../UC");
7
+ class PanTransformTC extends AppObject_1.AppObjectController {
8
+ constructor(appObject) {
9
+ super(appObject, PanTransformTC.type);
10
+ this.isPanning = false;
11
+ this.allow = (e) => {
12
+ return true;
13
+ };
14
+ this.onTouchStart = (e) => {
15
+ var _a, _b;
16
+ if (!this.allow(e)) {
17
+ this.isPanning = false;
18
+ (_a = this.panUC) === null || _a === void 0 ? void 0 : _a.cancelPan();
19
+ return;
20
+ }
21
+ (_b = this.panUC) === null || _b === void 0 ? void 0 : _b.initializePixel(e.touchCenter);
22
+ this.isPanning = true;
23
+ };
24
+ this.onTouchMove = (e) => {
25
+ var _a;
26
+ if (!this.isPanning)
27
+ return;
28
+ const pixelPosition = e.touches[0].position;
29
+ (_a = this.panUC) === null || _a === void 0 ? void 0 : _a.updatePixel(pixelPosition);
30
+ };
31
+ this.onTouchEnd = (e) => {
32
+ var _a;
33
+ this.isPanning = false;
34
+ (_a = this.panUC) === null || _a === void 0 ? void 0 : _a.finish();
35
+ };
36
+ const appObjects = appObject.appObjectRepo;
37
+ this.panUC = appObject.getComponent(UC_1.PanTransformUC.type);
38
+ if (!this.panUC) {
39
+ this.warn("Controller has been added to an App Object that does not have PanTransformUC. Add one first.");
40
+ return;
41
+ }
42
+ const touchInput = TouchController_1.TouchInputEntity.get(appObjects);
43
+ if (touchInput) {
44
+ touchInput.registerController(this);
45
+ }
46
+ else {
47
+ this.warn("Unable to find TouchInputEntity");
48
+ }
49
+ }
50
+ }
51
+ exports.PanTransformTC = PanTransformTC;
52
+ PanTransformTC.type = "PanTransformTC";
@@ -0,0 +1,13 @@
1
+ import { AppObject, AppObjectController } from "../../../../AppObject";
2
+ import { TouchController, TouchInputEvent } from "../../../TouchController";
3
+ import { PinchTransformUC } from "../../UC";
4
+ export declare class PinchTransformTC extends AppObjectController implements TouchController {
5
+ static readonly type = "PinchTransformTC";
6
+ private isPinching;
7
+ pinchUC?: PinchTransformUC;
8
+ allow: (e: TouchInputEvent) => boolean;
9
+ onTouchStart: (e: TouchInputEvent) => void;
10
+ onTouchMove: (e: TouchInputEvent) => void;
11
+ onTouchEnd: () => void;
12
+ constructor(appObject: AppObject);
13
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PinchTransformTC = void 0;
4
+ const AppObject_1 = require("../../../../AppObject");
5
+ const TouchController_1 = require("../../../TouchController");
6
+ const UC_1 = require("../../UC");
7
+ class PinchTransformTC extends AppObject_1.AppObjectController {
8
+ constructor(appObject) {
9
+ super(appObject, PinchTransformTC.type);
10
+ this.isPinching = false;
11
+ this.allow = (e) => {
12
+ return true;
13
+ };
14
+ this.onTouchStart = (e) => {
15
+ var _a;
16
+ this.isPinching = false;
17
+ if (e.touches.length !== 2) {
18
+ return;
19
+ }
20
+ if (!this.allow(e)) {
21
+ return;
22
+ }
23
+ (_a = this.pinchUC) === null || _a === void 0 ? void 0 : _a.initializePinch(e.touches[0].position, e.touches[1].position);
24
+ this.isPinching = true;
25
+ };
26
+ this.onTouchMove = (e) => {
27
+ var _a;
28
+ if (!this.isPinching)
29
+ return;
30
+ if (e.touches.length !== 2)
31
+ return;
32
+ (_a = this.pinchUC) === null || _a === void 0 ? void 0 : _a.doPinch(e.touches[0].position, e.touches[1].position);
33
+ };
34
+ this.onTouchEnd = () => {
35
+ var _a;
36
+ this.isPinching = false;
37
+ (_a = this.pinchUC) === null || _a === void 0 ? void 0 : _a.finishPinch();
38
+ };
39
+ const appObjects = appObject.appObjectRepo;
40
+ this.pinchUC = appObject.getComponent(UC_1.PinchTransformUC.type);
41
+ if (!this.pinchUC) {
42
+ this.error("App Object does not have PinchTransformUC");
43
+ return;
44
+ }
45
+ const touchInput = TouchController_1.TouchInputEntity.get(appObjects);
46
+ if (touchInput) {
47
+ touchInput.registerController(this);
48
+ }
49
+ else {
50
+ this.warn("Unable to find TouchInputEntity");
51
+ }
52
+ }
53
+ }
54
+ exports.PinchTransformTC = PinchTransformTC;
55
+ PinchTransformTC.type = "PinchTransformTC";
@@ -0,0 +1,3 @@
1
+ export * from "./DragScaleTransformTC";
2
+ export * from "./PanTransformTC";
3
+ export * from "./PinchTransformTC";
@@ -0,0 +1,15 @@
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("./DragScaleTransformTC"), exports);
14
+ __exportStar(require("./PanTransformTC"), exports);
15
+ __exportStar(require("./PinchTransformTC"), exports);
@@ -0,0 +1,3 @@
1
+ export * from "./Mouse";
2
+ export * from "./Stylus";
3
+ export * from "./Touch";
@@ -0,0 +1,15 @@
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("./Mouse"), exports);
14
+ __exportStar(require("./Stylus"), exports);
15
+ __exportStar(require("./Touch"), exports);
@@ -0,0 +1,14 @@
1
+ /// <reference types="jest" />
2
+ import { AppObject } from "../../../AppObject";
3
+ import { ParametricPlane } from "../../../ValueObjects";
4
+ import { BumpTransformScaleAboutPixelPointUC } from "../UC";
5
+ export declare class MockBumpTransformScaleAboutPixelPoint extends BumpTransformScaleAboutPixelPointUC {
6
+ enabled: boolean;
7
+ minScale?: number | undefined;
8
+ maxScale?: number | undefined;
9
+ pickPlane?: ParametricPlane | undefined;
10
+ sensitivity: number;
11
+ allow: jest.Mock<any, any>;
12
+ bump: jest.Mock<any, any>;
13
+ constructor(appObject: AppObject);
14
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MockBumpTransformScaleAboutPixelPoint = void 0;
4
+ const UC_1 = require("../UC");
5
+ class MockBumpTransformScaleAboutPixelPoint extends UC_1.BumpTransformScaleAboutPixelPointUC {
6
+ constructor(appObject) {
7
+ super(appObject, UC_1.BumpTransformScaleAboutPixelPointUC.type);
8
+ this.enabled = true;
9
+ this.sensitivity = 1;
10
+ this.allow = jest.fn();
11
+ this.bump = jest.fn();
12
+ }
13
+ }
14
+ exports.MockBumpTransformScaleAboutPixelPoint = MockBumpTransformScaleAboutPixelPoint;
@@ -0,0 +1,18 @@
1
+ /// <reference types="jest" />
2
+ import { AppObject } from "../../../AppObject";
3
+ import { PanTransformUC } from "../UC";
4
+ export declare class MockPanTransformUC extends PanTransformUC {
5
+ enabled: boolean;
6
+ minX?: number | undefined;
7
+ maxX?: number | undefined;
8
+ minY?: number | undefined;
9
+ maxY?: number | undefined;
10
+ dispatchStateChangeOnComplete: boolean;
11
+ updatePixel: jest.Mock<any, any>;
12
+ initializePixel: jest.Mock<any, any>;
13
+ finish: jest.Mock<any, any>;
14
+ cancelPan: jest.Mock<any, any>;
15
+ updateRay: jest.Mock<any, any>;
16
+ initializeRay: jest.Mock<any, any>;
17
+ constructor(appObject: AppObject);
18
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MockPanTransformUC = void 0;
4
+ const UC_1 = require("../UC");
5
+ class MockPanTransformUC extends UC_1.PanTransformUC {
6
+ constructor(appObject) {
7
+ super(appObject, UC_1.PanTransformUC.type);
8
+ this.enabled = true;
9
+ this.dispatchStateChangeOnComplete = false;
10
+ this.updatePixel = jest.fn();
11
+ this.initializePixel = jest.fn();
12
+ this.finish = jest.fn();
13
+ this.cancelPan = jest.fn();
14
+ this.updateRay = jest.fn();
15
+ this.initializeRay = jest.fn();
16
+ }
17
+ }
18
+ exports.MockPanTransformUC = MockPanTransformUC;
@@ -0,0 +1,15 @@
1
+ /// <reference types="jest" />
2
+ import { AppObject } from "../../../AppObject";
3
+ import { ParametricPlane } from "../../../ValueObjects";
4
+ import { PinchTransformUC } from "../UC";
5
+ export declare class MockPinchTransformUC extends PinchTransformUC {
6
+ enabled: boolean;
7
+ sensitivity: number;
8
+ minScale?: number | undefined;
9
+ maxScale?: number | undefined;
10
+ pickPlane?: ParametricPlane | undefined;
11
+ doPinch: jest.Mock<any, any>;
12
+ initializePinch: jest.Mock<any, any>;
13
+ finishPinch: jest.Mock<any, any>;
14
+ constructor(appObject: AppObject);
15
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MockPinchTransformUC = void 0;
4
+ const UC_1 = require("../UC");
5
+ class MockPinchTransformUC extends UC_1.PinchTransformUC {
6
+ constructor(appObject) {
7
+ super(appObject, UC_1.PinchTransformUC.type);
8
+ this.enabled = true;
9
+ this.sensitivity = 0;
10
+ this.doPinch = jest.fn();
11
+ this.initializePinch = jest.fn();
12
+ this.finishPinch = jest.fn();
13
+ }
14
+ }
15
+ exports.MockPinchTransformUC = MockPinchTransformUC;
@@ -0,0 +1,19 @@
1
+ /// <reference types="jest" />
2
+ import { AppObject } from "../../../AppObject";
3
+ import { ParametricPlane } from "../../../ValueObjects";
4
+ import { RayPanScaleTransformUC } from "../UC";
5
+ export declare class MockRayPanScaleTransformUC extends RayPanScaleTransformUC {
6
+ enabled: boolean;
7
+ sensitivity: number;
8
+ minScale?: number | undefined;
9
+ maxScale?: number | undefined;
10
+ minX?: number | undefined;
11
+ maxX?: number | undefined;
12
+ minY?: number | undefined;
13
+ maxY?: number | undefined;
14
+ pickPlane?: ParametricPlane | undefined;
15
+ update: jest.Mock<any, any>;
16
+ initialize: jest.Mock<any, any>;
17
+ finish: jest.Mock<any, any>;
18
+ constructor(appObject: AppObject);
19
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MockRayPanScaleTransformUC = void 0;
4
+ const UC_1 = require("../UC");
5
+ class MockRayPanScaleTransformUC extends UC_1.RayPanScaleTransformUC {
6
+ constructor(appObject) {
7
+ super(appObject, UC_1.RayPanScaleTransformUC.type);
8
+ this.enabled = true;
9
+ this.sensitivity = 1;
10
+ this.update = jest.fn();
11
+ this.initialize = jest.fn();
12
+ this.finish = jest.fn();
13
+ }
14
+ }
15
+ exports.MockRayPanScaleTransformUC = MockRayPanScaleTransformUC;
@@ -0,0 +1,18 @@
1
+ /// <reference types="jest" />
2
+ import { AppObject } from "../../../AppObject";
3
+ import { ParametricPlane } from "../../../ValueObjects";
4
+ import { ScaleTransformUC } from "../UC";
5
+ export declare class MockRayScaleTransform extends ScaleTransformUC {
6
+ enabled: boolean;
7
+ pixelSensitivity: number;
8
+ raySensitivity: number;
9
+ minScale?: number | undefined;
10
+ maxScale?: number | undefined;
11
+ pickPlane?: ParametricPlane | undefined;
12
+ updateRay: jest.Mock<any, any>;
13
+ initializeRay: jest.Mock<any, any>;
14
+ finish: jest.Mock<any, any>;
15
+ initializePixel: jest.Mock<any, any>;
16
+ updatePixel: jest.Mock<any, any>;
17
+ constructor(appObject: AppObject);
18
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MockRayScaleTransform = void 0;
4
+ const UC_1 = require("../UC");
5
+ class MockRayScaleTransform extends UC_1.ScaleTransformUC {
6
+ constructor(appObject) {
7
+ super(appObject, UC_1.ScaleTransformUC.type);
8
+ this.enabled = true;
9
+ this.pixelSensitivity = 1;
10
+ this.raySensitivity = 1;
11
+ this.updateRay = jest.fn();
12
+ this.initializeRay = jest.fn();
13
+ this.finish = jest.fn();
14
+ this.initializePixel = jest.fn();
15
+ this.updatePixel = jest.fn();
16
+ }
17
+ }
18
+ exports.MockRayScaleTransform = MockRayScaleTransform;
@@ -0,0 +1,5 @@
1
+ export * from "./MockBumpTransformScaleAboutPixelPoint";
2
+ export * from "./MockPanTransformUC";
3
+ export * from "./MockPinchTransformUC";
4
+ export * from "./MockRayPanScaleTransformUC";
5
+ export * from "./MockRayScaleTransform";
@@ -0,0 +1,17 @@
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("./MockBumpTransformScaleAboutPixelPoint"), exports);
14
+ __exportStar(require("./MockPanTransformUC"), exports);
15
+ __exportStar(require("./MockPinchTransformUC"), exports);
16
+ __exportStar(require("./MockRayPanScaleTransformUC"), exports);
17
+ __exportStar(require("./MockRayScaleTransform"), exports);
@@ -0,0 +1,13 @@
1
+ import { AppObject, AppObjectUC } from "../../../AppObject";
2
+ import { ParametricPlane, Vector2 } from "../../../ValueObjects";
3
+ export declare abstract class BumpTransformScaleAboutPixelPointUC extends AppObjectUC {
4
+ static readonly type = "BumpTransformScaleAboutPixelPointUC";
5
+ abstract sensitivity: number;
6
+ abstract minScale?: number | undefined;
7
+ abstract maxScale?: number | undefined;
8
+ abstract pickPlane?: ParametricPlane;
9
+ abstract enabled: boolean;
10
+ abstract allow(): boolean;
11
+ abstract bump(direction: "IN" | "OUT", pixelPosition: Vector2): void;
12
+ }
13
+ export declare function makeBumpTransformScaleAboutPixelPointUC(appObject: AppObject): BumpTransformScaleAboutPixelPointUC;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeBumpTransformScaleAboutPixelPointUC = exports.BumpTransformScaleAboutPixelPointUC = void 0;
4
+ const AppObject_1 = require("../../../AppObject");
5
+ const ValueObjects_1 = require("../../../ValueObjects");
6
+ const Babylon_1 = require("../../Babylon");
7
+ const Dispatcher_1 = require("../../Dispatcher");
8
+ const Entities_1 = require("../Entities");
9
+ class BumpTransformScaleAboutPixelPointUC extends AppObject_1.AppObjectUC {
10
+ }
11
+ exports.BumpTransformScaleAboutPixelPointUC = BumpTransformScaleAboutPixelPointUC;
12
+ BumpTransformScaleAboutPixelPointUC.type = "BumpTransformScaleAboutPixelPointUC";
13
+ function makeBumpTransformScaleAboutPixelPointUC(appObject) {
14
+ return new BumpTransformScaleAboutPixelPointUCImp(appObject);
15
+ }
16
+ exports.makeBumpTransformScaleAboutPixelPointUC = makeBumpTransformScaleAboutPixelPointUC;
17
+ class BumpTransformScaleAboutPixelPointUCImp extends BumpTransformScaleAboutPixelPointUC {
18
+ constructor(appObject) {
19
+ super(appObject, BumpTransformScaleAboutPixelPointUC.type);
20
+ this.enabled = true;
21
+ this.sensitivity = 0.1;
22
+ this.allow = () => {
23
+ return true;
24
+ };
25
+ this.bump = (direction, pixelPosition) => {
26
+ var _a, _b, _c;
27
+ if (!this.enabled)
28
+ return;
29
+ if (!this.transform)
30
+ return;
31
+ if (!this.allow())
32
+ return;
33
+ let bumpDirection = -1;
34
+ if (direction === "IN") {
35
+ bumpDirection = 1;
36
+ }
37
+ const currentScale = this.transform.worldScale.x;
38
+ const scaleDelta = bumpDirection * this.sensitivity * currentScale;
39
+ let pickPoint = ValueObjects_1.Vector3.Zero();
40
+ if (this.pickPlane) {
41
+ const pickRay = Babylon_1.pixelToSceneRay(pixelPosition, this.appObjects);
42
+ pickPoint = (_a = this.pickPlane.intersectLine(pickRay)) !== null && _a !== void 0 ? _a : ValueObjects_1.Vector3.Zero();
43
+ }
44
+ else {
45
+ pickPoint = (_c = (_b = Babylon_1.scenePixelPick(pixelPosition, this.appObjects)) === null || _b === void 0 ? void 0 : _b.worldPickPoint) !== null && _c !== void 0 ? _c : ValueObjects_1.Vector3.Zero();
46
+ }
47
+ this.bumpScaleAboutPoint(scaleDelta, pickPoint);
48
+ Dispatcher_1.dispatchStateChange(this.appObjects);
49
+ };
50
+ this.bumpScaleAboutPoint = (amount, worldPoint) => {
51
+ if (!this.transform)
52
+ return;
53
+ const localPickOffset = this.transform.worldPointToLocal(worldPoint);
54
+ const currentScale = this.transform.worldScale.x;
55
+ let newScale = currentScale + amount;
56
+ if (this.minScale !== undefined && newScale < this.minScale) {
57
+ newScale = this.minScale;
58
+ }
59
+ if (this.maxScale !== undefined && newScale > this.maxScale) {
60
+ newScale = this.maxScale;
61
+ }
62
+ this.transform.worldScale = new ValueObjects_1.Vector3(newScale, newScale, newScale);
63
+ const worldPickOffset = this.transform.localPointToWorld(localPickOffset);
64
+ const bump = ValueObjects_1.Vector3.Subtract(worldPoint, worldPickOffset);
65
+ this.transform.worldPosition = ValueObjects_1.Vector3.Add(bump, this.transform.worldPosition);
66
+ };
67
+ this.transform = appObject.getComponent(Entities_1.Transform3D.type);
68
+ if (!this.transform) {
69
+ this.error("BumpSceneRootScaleAboutPixelPointImp UC has been added to an App Object that does not have a Transform");
70
+ return;
71
+ }
72
+ }
73
+ }
@@ -0,0 +1,18 @@
1
+ import { AppObject, AppObjectUC } from "../../../AppObject";
2
+ import { ParametricLine, Vector2 } from "../../../ValueObjects";
3
+ export declare abstract class PanTransformUC extends AppObjectUC {
4
+ static readonly type = "PanTransformUC";
5
+ abstract minX?: number;
6
+ abstract maxX?: number;
7
+ abstract minY?: number;
8
+ abstract maxY?: number;
9
+ abstract dispatchStateChangeOnComplete: boolean;
10
+ abstract enabled: boolean;
11
+ abstract updatePixel: (pixel: Vector2) => void;
12
+ abstract initializePixel: (pixel: Vector2) => void;
13
+ abstract updateRay: (ray: ParametricLine) => void;
14
+ abstract initializeRay: (ray: ParametricLine) => void;
15
+ abstract finish: () => void;
16
+ abstract cancelPan: () => void;
17
+ }
18
+ export declare function makePanTransformUC(appObject: AppObject): PanTransformUC;