@vived/app 4.12.0 → 4.14.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 (110) hide show
  1. package/lib/Components/HoverLabel/Controllers/StylusHoverLabel.d.ts +2 -2
  2. package/lib/Components/HoverLabel/Controllers/StylusHoverLabel.js +3 -3
  3. package/lib/Components/Question/Entities/QuestionAnswerEntity.d.ts +0 -1
  4. package/lib/Components/Question/Entities/QuestionAnswerEntity.js +2 -6
  5. package/lib/Components/RequestHandler/UC/StartZSpaceUC.js +12 -1
  6. package/lib/Components/RequestHandler/UC/StopZSpaceUC.js +20 -7
  7. package/lib/Components/SceneRoot/Controllers/ScaleSceneRootSC.d.ts +14 -0
  8. package/lib/Components/SceneRoot/Controllers/ScaleSceneRootSC.js +55 -0
  9. package/lib/Components/SceneRoot/Controllers/SceneRootMoveSC.d.ts +14 -0
  10. package/lib/Components/SceneRoot/Controllers/SceneRootMoveSC.js +53 -0
  11. package/lib/Components/SceneRoot/Controllers/index.d.ts +2 -2
  12. package/lib/Components/SceneRoot/Controllers/index.js +2 -2
  13. package/lib/Components/Selection/Controller/HoverOnAppObjectSC.d.ts +11 -0
  14. package/lib/Components/Selection/Controller/HoverOnAppObjectSC.js +41 -0
  15. package/lib/Components/Selection/Controller/PressOnAppObjectSC.d.ts +18 -0
  16. package/lib/Components/Selection/Controller/PressOnAppObjectSC.js +70 -0
  17. package/lib/Components/Selection/Controller/SelectAppObjectSC.d.ts +11 -0
  18. package/lib/Components/Selection/Controller/SelectAppObjectSC.js +39 -0
  19. package/lib/Components/Selection/Controller/index.d.ts +3 -3
  20. package/lib/Components/Selection/Controller/index.js +3 -3
  21. package/lib/Components/Stylus/Entity/StylusEntity.d.ts +21 -0
  22. package/lib/Components/Stylus/Entity/StylusEntity.js +104 -0
  23. package/lib/Components/Stylus/Entity/index.d.ts +1 -0
  24. package/lib/Components/Stylus/Entity/index.js +13 -0
  25. package/lib/Components/Stylus/Mocks/MockEmulateStylusUC.d.ts +10 -0
  26. package/lib/Components/Stylus/Mocks/MockEmulateStylusUC.js +19 -0
  27. package/lib/Components/Stylus/Mocks/index.d.ts +1 -0
  28. package/lib/Components/Stylus/Mocks/index.js +13 -0
  29. package/lib/Components/Stylus/PMs/StylusColorLengthPM.d.ts +14 -0
  30. package/lib/Components/Stylus/PMs/StylusColorLengthPM.js +81 -0
  31. package/lib/Components/Stylus/PMs/StylusIsInUsePM.d.ts +6 -0
  32. package/lib/Components/Stylus/PMs/StylusIsInUsePM.js +36 -0
  33. package/lib/Components/Stylus/PMs/index.d.ts +2 -0
  34. package/lib/Components/Stylus/PMs/index.js +14 -0
  35. package/lib/Components/Stylus/UCs/EmulateStylusUC.d.ts +9 -0
  36. package/lib/Components/Stylus/UCs/EmulateStylusUC.js +132 -0
  37. package/lib/Components/Stylus/UCs/index.d.ts +1 -0
  38. package/lib/Components/Stylus/UCs/index.js +13 -0
  39. package/lib/Components/Stylus/index.d.ts +4 -0
  40. package/lib/Components/Stylus/index.js +16 -0
  41. package/lib/Components/Transform3D/Controllers/Mouse/DragScaleTransformMC.d.ts +12 -0
  42. package/lib/Components/Transform3D/Controllers/Mouse/DragScaleTransformMC.js +49 -0
  43. package/lib/Components/Transform3D/Controllers/Mouse/PanTransformMC.d.ts +12 -0
  44. package/lib/Components/Transform3D/Controllers/Mouse/PanTransformMC.js +48 -0
  45. package/lib/Components/Transform3D/Controllers/Mouse/RollScaleTransformMC.d.ts +9 -0
  46. package/lib/Components/Transform3D/Controllers/Mouse/RollScaleTransformMC.js +37 -0
  47. package/lib/Components/Transform3D/Controllers/Mouse/index.d.ts +3 -0
  48. package/lib/Components/Transform3D/Controllers/Mouse/index.js +15 -0
  49. package/lib/Components/Transform3D/Controllers/Stylus/PanScaleTransformSC.d.ts +13 -0
  50. package/lib/Components/Transform3D/Controllers/Stylus/PanScaleTransformSC.js +54 -0
  51. package/lib/Components/Transform3D/Controllers/Stylus/PanTransformSC.d.ts +13 -0
  52. package/lib/Components/Transform3D/Controllers/Stylus/PanTransformSC.js +54 -0
  53. package/lib/Components/Transform3D/Controllers/Stylus/ScaleTransformSC.d.ts +13 -0
  54. package/lib/Components/Transform3D/Controllers/Stylus/ScaleTransformSC.js +54 -0
  55. package/lib/Components/Transform3D/Controllers/Stylus/index.d.ts +3 -0
  56. package/lib/Components/Transform3D/Controllers/Stylus/index.js +15 -0
  57. package/lib/Components/Transform3D/Controllers/Touch/DragScaleTransformTC.d.ts +13 -0
  58. package/lib/Components/Transform3D/Controllers/Touch/DragScaleTransformTC.js +60 -0
  59. package/lib/Components/Transform3D/Controllers/Touch/PanTransformTC.d.ts +12 -0
  60. package/lib/Components/Transform3D/Controllers/Touch/PanTransformTC.js +52 -0
  61. package/lib/Components/Transform3D/Controllers/Touch/PinchTransformTC.d.ts +13 -0
  62. package/lib/Components/Transform3D/Controllers/Touch/PinchTransformTC.js +55 -0
  63. package/lib/Components/Transform3D/Controllers/Touch/index.d.ts +3 -0
  64. package/lib/Components/Transform3D/Controllers/Touch/index.js +15 -0
  65. package/lib/Components/Transform3D/Controllers/index.d.ts +3 -0
  66. package/lib/Components/Transform3D/Controllers/index.js +15 -0
  67. package/lib/Components/Transform3D/Mocks/MockBumpTransformScaleAboutPixelPoint.d.ts +12 -0
  68. package/lib/Components/Transform3D/Mocks/MockBumpTransformScaleAboutPixelPoint.js +14 -0
  69. package/lib/Components/Transform3D/Mocks/MockPanTransformUC.d.ts +18 -0
  70. package/lib/Components/Transform3D/Mocks/MockPanTransformUC.js +18 -0
  71. package/lib/Components/Transform3D/Mocks/MockPinchTransformUC.d.ts +13 -0
  72. package/lib/Components/Transform3D/Mocks/MockPinchTransformUC.js +15 -0
  73. package/lib/Components/Transform3D/Mocks/MockRayPanScaleTransformUC.d.ts +17 -0
  74. package/lib/Components/Transform3D/Mocks/MockRayPanScaleTransformUC.js +15 -0
  75. package/lib/Components/Transform3D/Mocks/MockRayScaleTransform.d.ts +16 -0
  76. package/lib/Components/Transform3D/Mocks/MockRayScaleTransform.js +18 -0
  77. package/lib/Components/Transform3D/Mocks/index.d.ts +5 -0
  78. package/lib/Components/Transform3D/Mocks/index.js +17 -0
  79. package/lib/Components/Transform3D/UC/BumpTransformScaleAboutPixelPoint.d.ts +12 -0
  80. package/lib/Components/Transform3D/UC/BumpTransformScaleAboutPixelPoint.js +67 -0
  81. package/lib/Components/Transform3D/UC/PanTransformUC.d.ts +18 -0
  82. package/lib/Components/Transform3D/UC/PanTransformUC.js +94 -0
  83. package/lib/Components/Transform3D/UC/PinchTransform.d.ts +13 -0
  84. package/lib/Components/Transform3D/UC/PinchTransform.js +90 -0
  85. package/lib/Components/Transform3D/UC/RayPanScaleTransform.d.ts +17 -0
  86. package/lib/Components/Transform3D/UC/RayPanScaleTransform.js +108 -0
  87. package/lib/Components/Transform3D/UC/ScaleTransform.d.ts +16 -0
  88. package/lib/Components/Transform3D/UC/ScaleTransform.js +104 -0
  89. package/lib/Components/Transform3D/UC/StylusMoveTransformUC.js +14 -35
  90. package/lib/Components/Transform3D/UC/index.d.ts +6 -0
  91. package/lib/Components/Transform3D/UC/index.js +6 -0
  92. package/lib/Components/Transform3D/index.d.ts +2 -0
  93. package/lib/Components/Transform3D/index.js +2 -0
  94. package/lib/Components/index.d.ts +5 -4
  95. package/lib/Components/index.js +5 -4
  96. package/lib/Components/zSpace/Entities/ZSpaceEntity.d.ts +0 -2
  97. package/lib/Components/zSpace/Entities/ZSpaceEntity.js +0 -3
  98. package/lib/Components/zSpace/Entities/index.d.ts +0 -1
  99. package/lib/Components/zSpace/Entities/index.js +0 -1
  100. package/lib/Components/zSpace/PM/index.d.ts +0 -2
  101. package/lib/Components/zSpace/PM/index.js +0 -2
  102. package/lib/Components/zSpace/UC/StylusFromGamepadHook.d.ts +2 -3
  103. package/lib/Components/zSpace/UC/StylusFromGamepadHook.js +14 -13
  104. package/lib/Components/zSpace/index.d.ts +0 -1
  105. package/lib/Components/zSpace/index.js +0 -1
  106. package/lib/Entities/TransformNode.d.ts +0 -55
  107. package/lib/ValueObjects/Color.js +1 -1
  108. package/lib/ValueObjects/ParametricLine.d.ts +3 -0
  109. package/lib/ValueObjects/ParametricLine.js +13 -3
  110. package/package.json +1 -1
@@ -0,0 +1,13 @@
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("./StylusEntity"), exports);
@@ -0,0 +1,10 @@
1
+ /// <reference types="jest" />
2
+ import { AppObject, AppObjectRepo } from "../../../AppObject";
3
+ import { EmulateStylusUC } from "../UCs/EmulateStylusUC";
4
+ export declare class MockEmulateStylusUC extends EmulateStylusUC {
5
+ get isEmulating(): boolean;
6
+ startEmulating: jest.Mock<any, any>;
7
+ stopEmulating: jest.Mock<any, any>;
8
+ constructor(appObject: AppObject);
9
+ }
10
+ export declare function makeMockEmulateStylusUC(appObjects: AppObjectRepo): MockEmulateStylusUC;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeMockEmulateStylusUC = exports.MockEmulateStylusUC = void 0;
4
+ const EmulateStylusUC_1 = require("../UCs/EmulateStylusUC");
5
+ class MockEmulateStylusUC extends EmulateStylusUC_1.EmulateStylusUC {
6
+ constructor(appObject) {
7
+ super(appObject, EmulateStylusUC_1.EmulateStylusUC.type);
8
+ this.startEmulating = jest.fn();
9
+ this.stopEmulating = jest.fn();
10
+ }
11
+ get isEmulating() {
12
+ throw new Error("Method not implemented.");
13
+ }
14
+ }
15
+ exports.MockEmulateStylusUC = MockEmulateStylusUC;
16
+ function makeMockEmulateStylusUC(appObjects) {
17
+ return new MockEmulateStylusUC(appObjects.getOrCreate("MockEmulateStylusUC"));
18
+ }
19
+ exports.makeMockEmulateStylusUC = makeMockEmulateStylusUC;
@@ -0,0 +1 @@
1
+ export * from "./MockEmulateStylusUC";
@@ -0,0 +1,13 @@
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("./MockEmulateStylusUC"), exports);
@@ -0,0 +1,14 @@
1
+ import { AppObject, AppObjectPM, AppObjectRepo } from "../../../AppObject";
2
+ import { Color } from "../../../ValueObjects";
3
+ export interface StylusColorLengthVM {
4
+ color: Color;
5
+ length: number;
6
+ }
7
+ export declare abstract class StylusColorLengthPM extends AppObjectPM<StylusColorLengthVM> {
8
+ static readonly type = "StylusColorLengthPM";
9
+ abstract rayColorNoPick: Color;
10
+ abstract rayColorPick: Color;
11
+ abstract defaultLength: number;
12
+ static get(appObjects: AppObjectRepo): StylusColorLengthPM | undefined;
13
+ }
14
+ export declare function makeStylusColorLengthPM(appObject: AppObject): StylusColorLengthPM;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeStylusColorLengthPM = exports.StylusColorLengthPM = void 0;
4
+ const AppObject_1 = require("../../../AppObject");
5
+ const ValueObjects_1 = require("../../../ValueObjects");
6
+ const Babylon_1 = require("../../Babylon");
7
+ const StylusEntity_1 = require("../Entity/StylusEntity");
8
+ class StylusColorLengthPM extends AppObject_1.AppObjectPM {
9
+ static get(appObjects) {
10
+ return AppObject_1.getSingletonComponent(StylusColorLengthPM.type, appObjects);
11
+ }
12
+ }
13
+ exports.StylusColorLengthPM = StylusColorLengthPM;
14
+ StylusColorLengthPM.type = "StylusColorLengthPM";
15
+ function makeStylusColorLengthPM(appObject) {
16
+ return new StylusColorLengthPMImp(appObject);
17
+ }
18
+ exports.makeStylusColorLengthPM = makeStylusColorLengthPM;
19
+ class StylusColorLengthPMImp extends StylusColorLengthPM {
20
+ constructor(appObject) {
21
+ super(appObject, StylusColorLengthPM.type);
22
+ this.defaultLength = 1;
23
+ this.rayColorNoPick = ValueObjects_1.Color.RGB(128, 128, 128);
24
+ this.rayColorPick = ValueObjects_1.Color.RGB(0, 255, 0);
25
+ this.onEntityChange = () => {
26
+ if (!this.stylus || !this.stylus.isInUse) {
27
+ this.setDefaultVM();
28
+ return;
29
+ }
30
+ const pickRay = this.stylus.pickRay;
31
+ const scenePickUC = Babylon_1.SceneRayPickUC.get(this.appObject.appObjectRepo);
32
+ if (!scenePickUC) {
33
+ this.setDefaultVM();
34
+ return;
35
+ }
36
+ const scenePick = scenePickUC.sceneRayPick(pickRay);
37
+ let color = this.rayColorNoPick;
38
+ let length = this.defaultLength;
39
+ if (scenePick && (scenePick === null || scenePick === void 0 ? void 0 : scenePick.hit) && scenePick.worldPickPoint) {
40
+ color = this.rayColorPick;
41
+ length = Math.abs(ValueObjects_1.Vector3.Subtract(this.stylus.transform.worldPosition, scenePick.worldPickPoint).magnitude);
42
+ }
43
+ const vm = {
44
+ color,
45
+ length
46
+ };
47
+ this.doUpdateView(vm);
48
+ };
49
+ this.dispose = () => {
50
+ var _a, _b;
51
+ super.dispose();
52
+ (_a = this.stylus) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onEntityChange);
53
+ (_b = this.stylus) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
54
+ };
55
+ this.stylus = appObject.getComponent(StylusEntity_1.StylusEntity.type);
56
+ if (this.stylus) {
57
+ this.stylus.addChangeObserver(this.onEntityChange);
58
+ this.stylus.addOnDisposeObserver(() => {
59
+ this.dispose();
60
+ });
61
+ this.onEntityChange();
62
+ }
63
+ else {
64
+ this.warn("App Object does not have a Stylus Entity");
65
+ }
66
+ this.appObjects.registerSingleton(this);
67
+ }
68
+ vmsAreEqual(a, b) {
69
+ if (ValueObjects_1.Color.Equal(a.color, b.color) && a.length === b.length) {
70
+ return true;
71
+ }
72
+ return false;
73
+ }
74
+ setDefaultVM() {
75
+ const vm = {
76
+ color: this.rayColorNoPick,
77
+ length: 0
78
+ };
79
+ this.doUpdateView(vm);
80
+ }
81
+ }
@@ -0,0 +1,6 @@
1
+ import { AppObject, AppObjectPM, AppObjectRepo } from "../../../AppObject";
2
+ export declare abstract class StylusIsInUsePM extends AppObjectPM<boolean> {
3
+ static readonly type = "StylusIsInUsePM";
4
+ static get: (appObjects: AppObjectRepo) => StylusIsInUsePM | undefined;
5
+ }
6
+ export declare function makeStylusIsInUsePM(appObject: AppObject): StylusIsInUsePM;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeStylusIsInUsePM = exports.StylusIsInUsePM = void 0;
4
+ const AppObject_1 = require("../../../AppObject");
5
+ const StylusEntity_1 = require("../Entity/StylusEntity");
6
+ class StylusIsInUsePM extends AppObject_1.AppObjectPM {
7
+ }
8
+ exports.StylusIsInUsePM = StylusIsInUsePM;
9
+ StylusIsInUsePM.type = "StylusIsInUsePM";
10
+ StylusIsInUsePM.get = (appObjects) => AppObject_1.getSingletonComponent(StylusIsInUsePM.type, appObjects);
11
+ function makeStylusIsInUsePM(appObject) {
12
+ return new StylusIsInUsePMImp(appObject);
13
+ }
14
+ exports.makeStylusIsInUsePM = makeStylusIsInUsePM;
15
+ class StylusIsInUsePMImp extends StylusIsInUsePM {
16
+ constructor(appObject) {
17
+ super(appObject, StylusIsInUsePM.type);
18
+ this.onStylusChange = () => {
19
+ if (!this.stylus)
20
+ return;
21
+ this.doUpdateView(this.stylus.isInUse);
22
+ };
23
+ this.stylus = appObject.getComponent(StylusEntity_1.StylusEntity.type);
24
+ if (this.stylus) {
25
+ this.stylus.addChangeObserver(this.onStylusChange);
26
+ this.onStylusChange();
27
+ }
28
+ else {
29
+ this.warn("App Object does not have a Stylus Entity");
30
+ }
31
+ this.appObjects.registerSingleton(this);
32
+ }
33
+ vmsAreEqual(a, b) {
34
+ return a === b;
35
+ }
36
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./StylusColorLengthPM";
2
+ export * from "./StylusIsInUsePM";
@@ -0,0 +1,14 @@
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("./StylusColorLengthPM"), exports);
14
+ __exportStar(require("./StylusIsInUsePM"), exports);
@@ -0,0 +1,9 @@
1
+ import { AppObject, AppObjectRepo, AppObjectUC } from "../../../AppObject";
2
+ export declare abstract class EmulateStylusUC extends AppObjectUC {
3
+ static type: string;
4
+ abstract get isEmulating(): boolean;
5
+ abstract startEmulating(): void;
6
+ abstract stopEmulating(): void;
7
+ static get(appObjects: AppObjectRepo): EmulateStylusUC | undefined;
8
+ }
9
+ export declare function makeEmulateStylusUC(appObject: AppObject): EmulateStylusUC;
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeEmulateStylusUC = exports.EmulateStylusUC = void 0;
4
+ const AppObject_1 = require("../../../AppObject");
5
+ const ValueObjects_1 = require("../../../ValueObjects");
6
+ const Babylon_1 = require("../../Babylon");
7
+ const MouseInput_1 = require("../../MouseInput");
8
+ const TouchController_1 = require("../../TouchController");
9
+ const StylusEntity_1 = require("../Entity/StylusEntity");
10
+ class EmulateStylusUC extends AppObject_1.AppObjectUC {
11
+ static get(appObjects) {
12
+ return AppObject_1.getSingletonComponent(EmulateStylusUC.type, appObjects);
13
+ }
14
+ }
15
+ exports.EmulateStylusUC = EmulateStylusUC;
16
+ EmulateStylusUC.type = "EmulateStylusUC";
17
+ function makeEmulateStylusUC(appObject) {
18
+ return new EmulateStylusUCImp(appObject);
19
+ }
20
+ exports.makeEmulateStylusUC = makeEmulateStylusUC;
21
+ class EmulateStylusUCImp extends EmulateStylusUC {
22
+ constructor(appObject) {
23
+ super(appObject, EmulateStylusUC.type);
24
+ this._eventElement = undefined;
25
+ this.lastMousePos = ValueObjects_1.Vector2.Zero();
26
+ this._isEmulating = false;
27
+ this.screenPlane = ValueObjects_1.ParametricPlane.FromPointNormal(ValueObjects_1.Vector3.Zero(), ValueObjects_1.Vector3.Backward());
28
+ this.startEmulating = () => {
29
+ var _a;
30
+ if (!this.mouseInput)
31
+ return;
32
+ if (!this.stylus)
33
+ return;
34
+ if (this._isEmulating === true)
35
+ return;
36
+ this._eventElement = this.mouseInput.eventElement;
37
+ if (!this._eventElement) {
38
+ this.warn("No event element");
39
+ return;
40
+ }
41
+ this.mouseInput.clearInputElement();
42
+ (_a = this.touchInput) === null || _a === void 0 ? void 0 : _a.clearInputElement();
43
+ this._eventElement.addEventListener("mousedown", this.onMouseDown, false);
44
+ this._eventElement.addEventListener("mouseup", this.onMouseUp, false);
45
+ this._eventElement.addEventListener("mousemove", this.onMouseMove, false);
46
+ this._eventElement.addEventListener("keydown", this.submitKeyDown, false);
47
+ this.stylus.transform.localPosition = new ValueObjects_1.Vector3(0.05, -0.05, -0.5);
48
+ this._isEmulating = true;
49
+ };
50
+ this.stopEmulating = () => {
51
+ var _a;
52
+ if (!this.mouseInput)
53
+ return;
54
+ if (this._isEmulating === false)
55
+ return;
56
+ if (this._eventElement) {
57
+ this._eventElement.removeEventListener("mousedown", this.onMouseDown, false);
58
+ this._eventElement.removeEventListener("mouseup", this.onMouseUp, false);
59
+ this._eventElement.removeEventListener("mousemove", this.onMouseMove, false);
60
+ this._eventElement.removeEventListener("keydown", this.submitKeyDown, false);
61
+ this.mouseInput.setEventElement(this._eventElement);
62
+ (_a = this.touchInput) === null || _a === void 0 ? void 0 : _a.setEventElement(this._eventElement);
63
+ }
64
+ this._eventElement = undefined;
65
+ this._isEmulating = false;
66
+ };
67
+ this.submitKeyDown = (e) => {
68
+ const bumpAmount = 0.01;
69
+ let bump = ValueObjects_1.Vector3.Zero();
70
+ switch (e.code) {
71
+ case "KeyA":
72
+ bump = new ValueObjects_1.Vector3(-bumpAmount, 0, 0);
73
+ break;
74
+ case "KeyD":
75
+ bump = new ValueObjects_1.Vector3(bumpAmount, 0, 0);
76
+ break;
77
+ case "KeyW":
78
+ bump = new ValueObjects_1.Vector3(0, 0, bumpAmount);
79
+ break;
80
+ case "KeyS":
81
+ bump = new ValueObjects_1.Vector3(0, 0, -bumpAmount);
82
+ break;
83
+ }
84
+ if (!this.stylus)
85
+ return;
86
+ const currentPos = this.stylus.transform.localPosition;
87
+ this.stylus.transform.localPosition = ValueObjects_1.Vector3.Add(currentPos, bump);
88
+ this.pointAtMouse(this.lastMousePos);
89
+ };
90
+ this.onMouseDown = (e) => {
91
+ if (!this.stylus)
92
+ return;
93
+ this.stylus.updateButtonState(e.button, true);
94
+ };
95
+ this.onMouseUp = (e) => {
96
+ if (!this.stylus)
97
+ return;
98
+ this.stylus.updateButtonState(e.button, false);
99
+ };
100
+ this.onMouseMove = (e) => {
101
+ const px = e.offsetX;
102
+ const py = e.offsetY;
103
+ const pos = new ValueObjects_1.Vector2(px, py);
104
+ this.pointAtMouse(pos);
105
+ this.lastMousePos = pos;
106
+ };
107
+ this.pointAtMouse = (pos) => {
108
+ if (!this.stylus)
109
+ return;
110
+ const ray = Babylon_1.pixelToSceneRay(pos, this.appObjects);
111
+ const hit = this.screenPlane.intersectLine(ray);
112
+ if (!hit) {
113
+ return;
114
+ }
115
+ const direction = ValueObjects_1.Vector3.Subtract(hit, this.stylus.transform.localPosition);
116
+ this.stylus.transform.localRotation = ValueObjects_1.Quaternion.FromDirectionVector(direction);
117
+ };
118
+ this.appObjects.registerSingleton(this);
119
+ }
120
+ get mouseInput() {
121
+ return this.getCachedSingleton(MouseInput_1.MouseInputEntity.type);
122
+ }
123
+ get touchInput() {
124
+ return this.getCachedSingleton(TouchController_1.TouchInputEntity.type);
125
+ }
126
+ get stylus() {
127
+ return this.getCachedSingleton(StylusEntity_1.StylusEntity.type);
128
+ }
129
+ get isEmulating() {
130
+ return this._isEmulating;
131
+ }
132
+ }
@@ -0,0 +1 @@
1
+ export * from "./EmulateStylusUC";
@@ -0,0 +1,13 @@
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("./EmulateStylusUC"), exports);
@@ -0,0 +1,4 @@
1
+ export * from "./Entity";
2
+ export * from "./Mocks";
3
+ export * from "./PMs";
4
+ export * from "./UCs";
@@ -0,0 +1,16 @@
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("./Entity"), exports);
14
+ __exportStar(require("./Mocks"), exports);
15
+ __exportStar(require("./PMs"), exports);
16
+ __exportStar(require("./UCs"), exports);
@@ -0,0 +1,12 @@
1
+ import { AppObject, AppObjectController } from "../../../../AppObject";
2
+ import { MouseController, MouseInputEvent } from "../../../MouseInput";
3
+ export declare class DragScaleTransformMC extends AppObjectController implements MouseController {
4
+ static readonly type = "DragScaleTransformMC";
5
+ private isDragging;
6
+ private scaleUC?;
7
+ allow: (e: MouseInputEvent) => boolean;
8
+ onDown: (e: MouseInputEvent) => void;
9
+ onMove: (e: MouseInputEvent) => void;
10
+ onUp: () => void;
11
+ constructor(appObject: AppObject);
12
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DragScaleTransformMC = void 0;
4
+ const AppObject_1 = require("../../../../AppObject");
5
+ const MouseInput_1 = require("../../../MouseInput");
6
+ const UC_1 = require("../../UC");
7
+ class DragScaleTransformMC extends AppObject_1.AppObjectController {
8
+ constructor(appObject) {
9
+ super(appObject, DragScaleTransformMC.type);
10
+ this.isDragging = false;
11
+ this.allow = (e) => {
12
+ return true;
13
+ };
14
+ this.onDown = (e) => {
15
+ var _a;
16
+ this.isDragging = false;
17
+ if (!this.allow(e))
18
+ return;
19
+ const pixelPosition = e.position;
20
+ (_a = this.scaleUC) === null || _a === void 0 ? void 0 : _a.initializePixel(pixelPosition);
21
+ this.isDragging = true;
22
+ };
23
+ this.onMove = (e) => {
24
+ var _a;
25
+ if (!this.isDragging)
26
+ return;
27
+ (_a = this.scaleUC) === null || _a === void 0 ? void 0 : _a.updatePixel(e.position);
28
+ };
29
+ this.onUp = () => {
30
+ var _a;
31
+ this.isDragging = false;
32
+ (_a = this.scaleUC) === null || _a === void 0 ? void 0 : _a.finish();
33
+ };
34
+ this.scaleUC = appObject.getComponent(UC_1.ScaleTransformUC.type);
35
+ if (!this.scaleUC) {
36
+ this.error("App Object that does not have ScaleTransformUC");
37
+ return;
38
+ }
39
+ const mouseInput = MouseInput_1.MouseInputEntity.get(this.appObjects);
40
+ if (mouseInput) {
41
+ mouseInput.registerController(this);
42
+ }
43
+ else {
44
+ this.warn("Unable to find MouseInputEntity");
45
+ }
46
+ }
47
+ }
48
+ exports.DragScaleTransformMC = DragScaleTransformMC;
49
+ DragScaleTransformMC.type = "DragScaleTransformMC";
@@ -0,0 +1,12 @@
1
+ import { AppObject, AppObjectController } from "../../../../AppObject";
2
+ import { MouseController, MouseInputEvent } from "../../../MouseInput";
3
+ export declare class PanTransformMC extends AppObjectController implements MouseController {
4
+ static readonly type = "PanTransformMC";
5
+ private doPan;
6
+ allow: (e: MouseInputEvent) => boolean;
7
+ private panUC?;
8
+ onDown: (e: MouseInputEvent) => void;
9
+ onMove: (e: MouseInputEvent) => void;
10
+ onUp: () => void;
11
+ constructor(appObject: AppObject);
12
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PanTransformMC = void 0;
4
+ const AppObject_1 = require("../../../../AppObject");
5
+ const MouseInput_1 = require("../../../MouseInput");
6
+ const UC_1 = require("../../UC");
7
+ class PanTransformMC extends AppObject_1.AppObjectController {
8
+ constructor(appObject) {
9
+ super(appObject, PanTransformMC.type);
10
+ this.doPan = false;
11
+ this.allow = (e) => {
12
+ return true;
13
+ };
14
+ this.onDown = (e) => {
15
+ var _a;
16
+ this.doPan = false;
17
+ if (!this.allow(e))
18
+ return;
19
+ (_a = this.panUC) === null || _a === void 0 ? void 0 : _a.initializePixel(e.position);
20
+ this.doPan = true;
21
+ };
22
+ this.onMove = (e) => {
23
+ var _a;
24
+ if (!this.doPan)
25
+ return;
26
+ (_a = this.panUC) === null || _a === void 0 ? void 0 : _a.updatePixel(e.position);
27
+ };
28
+ this.onUp = () => {
29
+ var _a;
30
+ this.doPan = false;
31
+ (_a = this.panUC) === null || _a === void 0 ? void 0 : _a.finish();
32
+ };
33
+ this.panUC = appObject.getComponent(UC_1.PanTransformUC.type);
34
+ if (!this.panUC) {
35
+ this.error("Controller has been added to an App Object that does not have PanTransformUC. Add one first.");
36
+ return;
37
+ }
38
+ const mouseInput = MouseInput_1.MouseInputEntity.get(this.appObjects);
39
+ if (mouseInput) {
40
+ mouseInput.registerController(this);
41
+ }
42
+ else {
43
+ this.warn("Unable to find MouseInputEntity");
44
+ }
45
+ }
46
+ }
47
+ exports.PanTransformMC = PanTransformMC;
48
+ PanTransformMC.type = "PanTransformMC";
@@ -0,0 +1,9 @@
1
+ import { AppObject, AppObjectController } from "../../../../AppObject";
2
+ import { MouseController, MouseWheelEvent } from "../../../MouseInput";
3
+ export declare class RollScaleTransformMC extends AppObjectController implements MouseController {
4
+ static readonly type = "RollScaleTransformMC";
5
+ private bumpScaleUC?;
6
+ allow: (e: MouseWheelEvent) => boolean;
7
+ onWheel: (e: MouseWheelEvent) => void;
8
+ constructor(appObject: AppObject);
9
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RollScaleTransformMC = void 0;
4
+ const AppObject_1 = require("../../../../AppObject");
5
+ const MouseInput_1 = require("../../../MouseInput");
6
+ const UC_1 = require("../../UC");
7
+ class RollScaleTransformMC extends AppObject_1.AppObjectController {
8
+ constructor(appObject) {
9
+ super(appObject, RollScaleTransformMC.type);
10
+ this.allow = (e) => {
11
+ return true;
12
+ };
13
+ this.onWheel = (e) => {
14
+ if (!this.allow(e))
15
+ return;
16
+ if (!this.bumpScaleUC) {
17
+ return;
18
+ }
19
+ this.bumpScaleUC.bump(e.event.deltaY > 0 ? "OUT" : "IN", e.position);
20
+ };
21
+ this.bumpScaleUC =
22
+ appObject.getComponent(UC_1.BumpTransformScaleAboutPixelPointUC.type);
23
+ if (!this.bumpScaleUC) {
24
+ this.error("Controller has been added to an App Object that does not have BumpTransformScaleAboutPixelPointUC. Add one first.");
25
+ return;
26
+ }
27
+ const mouseInput = MouseInput_1.MouseInputEntity.get(this.appObjects);
28
+ if (mouseInput) {
29
+ mouseInput.registerController(this);
30
+ }
31
+ else {
32
+ this.error("Unable to find MouseInputEntity");
33
+ }
34
+ }
35
+ }
36
+ exports.RollScaleTransformMC = RollScaleTransformMC;
37
+ RollScaleTransformMC.type = "RollScaleTransformMC";
@@ -0,0 +1,3 @@
1
+ export * from "./DragScaleTransformMC";
2
+ export * from "./PanTransformMC";
3
+ export * from "./RollScaleTransformMC";
@@ -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("./DragScaleTransformMC"), exports);
14
+ __exportStar(require("./PanTransformMC"), exports);
15
+ __exportStar(require("./RollScaleTransformMC"), exports);
@@ -0,0 +1,13 @@
1
+ import { AppObject, AppObjectController } from "../../../../AppObject";
2
+ import { StylusController } from "../../../Stylus";
3
+ export declare class PanScaleTransformSC extends AppObjectController implements StylusController {
4
+ static readonly type = "PanScaleTransformSC";
5
+ private stylus?;
6
+ private uc?;
7
+ private doPan;
8
+ allow: (button: number) => boolean;
9
+ onButtonDown: (button: number) => void;
10
+ onButtonUp: () => void;
11
+ onStylusMove: () => void;
12
+ constructor(appObject: AppObject);
13
+ }