@vived/app 4.13.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.
- package/lib/Components/Question/Entities/QuestionAnswerEntity.d.ts +0 -1
- package/lib/Components/Question/Entities/QuestionAnswerEntity.js +2 -6
- package/lib/Components/Transform3D/Controllers/Mouse/DragScaleTransformMC.d.ts +12 -0
- package/lib/Components/Transform3D/Controllers/Mouse/DragScaleTransformMC.js +49 -0
- package/lib/Components/Transform3D/Controllers/Mouse/PanTransformMC.d.ts +12 -0
- package/lib/Components/Transform3D/Controllers/Mouse/PanTransformMC.js +48 -0
- package/lib/Components/Transform3D/Controllers/Mouse/RollScaleTransformMC.d.ts +9 -0
- package/lib/Components/Transform3D/Controllers/Mouse/RollScaleTransformMC.js +37 -0
- package/lib/Components/Transform3D/Controllers/Mouse/index.d.ts +3 -0
- package/lib/Components/Transform3D/Controllers/Mouse/index.js +15 -0
- package/lib/Components/Transform3D/Controllers/Stylus/PanScaleTransformSC.d.ts +13 -0
- package/lib/Components/Transform3D/Controllers/Stylus/PanScaleTransformSC.js +54 -0
- package/lib/Components/Transform3D/Controllers/Stylus/PanTransformSC.d.ts +13 -0
- package/lib/Components/Transform3D/Controllers/Stylus/PanTransformSC.js +54 -0
- package/lib/Components/Transform3D/Controllers/Stylus/ScaleTransformSC.d.ts +13 -0
- package/lib/Components/Transform3D/Controllers/Stylus/ScaleTransformSC.js +54 -0
- package/lib/Components/Transform3D/Controllers/Stylus/index.d.ts +3 -0
- package/lib/Components/Transform3D/Controllers/Stylus/index.js +15 -0
- package/lib/Components/Transform3D/Controllers/Touch/DragScaleTransformTC.d.ts +13 -0
- package/lib/Components/Transform3D/Controllers/Touch/DragScaleTransformTC.js +60 -0
- package/lib/Components/Transform3D/Controllers/Touch/PanTransformTC.d.ts +12 -0
- package/lib/Components/Transform3D/Controllers/Touch/PanTransformTC.js +52 -0
- package/lib/Components/Transform3D/Controllers/Touch/PinchTransformTC.d.ts +13 -0
- package/lib/Components/Transform3D/Controllers/Touch/PinchTransformTC.js +55 -0
- package/lib/Components/Transform3D/Controllers/Touch/index.d.ts +3 -0
- package/lib/Components/Transform3D/Controllers/Touch/index.js +15 -0
- package/lib/Components/Transform3D/Controllers/index.d.ts +3 -0
- package/lib/Components/Transform3D/Controllers/index.js +15 -0
- package/lib/Components/Transform3D/Mocks/MockBumpTransformScaleAboutPixelPoint.d.ts +12 -0
- package/lib/Components/Transform3D/Mocks/MockBumpTransformScaleAboutPixelPoint.js +14 -0
- package/lib/Components/Transform3D/Mocks/MockPanTransformUC.d.ts +18 -0
- package/lib/Components/Transform3D/Mocks/MockPanTransformUC.js +18 -0
- package/lib/Components/Transform3D/Mocks/MockPinchTransformUC.d.ts +13 -0
- package/lib/Components/Transform3D/Mocks/MockPinchTransformUC.js +15 -0
- package/lib/Components/Transform3D/Mocks/MockRayPanScaleTransformUC.d.ts +17 -0
- package/lib/Components/Transform3D/Mocks/MockRayPanScaleTransformUC.js +15 -0
- package/lib/Components/Transform3D/Mocks/MockRayScaleTransform.d.ts +16 -0
- package/lib/Components/Transform3D/Mocks/MockRayScaleTransform.js +18 -0
- package/lib/Components/Transform3D/Mocks/index.d.ts +5 -0
- package/lib/Components/Transform3D/Mocks/index.js +17 -0
- package/lib/Components/Transform3D/UC/BumpTransformScaleAboutPixelPoint.d.ts +12 -0
- package/lib/Components/Transform3D/UC/BumpTransformScaleAboutPixelPoint.js +67 -0
- package/lib/Components/Transform3D/UC/PanTransformUC.d.ts +18 -0
- package/lib/Components/Transform3D/UC/PanTransformUC.js +94 -0
- package/lib/Components/Transform3D/UC/PinchTransform.d.ts +13 -0
- package/lib/Components/Transform3D/UC/PinchTransform.js +90 -0
- package/lib/Components/Transform3D/UC/RayPanScaleTransform.d.ts +17 -0
- package/lib/Components/Transform3D/UC/RayPanScaleTransform.js +108 -0
- package/lib/Components/Transform3D/UC/ScaleTransform.d.ts +16 -0
- package/lib/Components/Transform3D/UC/ScaleTransform.js +104 -0
- package/lib/Components/Transform3D/UC/index.d.ts +6 -0
- package/lib/Components/Transform3D/UC/index.js +6 -0
- package/lib/Components/Transform3D/index.d.ts +2 -0
- package/lib/Components/Transform3D/index.js +2 -0
- package/package.json +1 -1
|
@@ -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,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,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,12 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { AppObject } from "../../../AppObject";
|
|
3
|
+
import { BumpTransformScaleAboutPixelPointUC } from "../UC";
|
|
4
|
+
export declare class MockBumpTransformScaleAboutPixelPoint extends BumpTransformScaleAboutPixelPointUC {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
minScale?: number | undefined;
|
|
7
|
+
maxScale?: number | undefined;
|
|
8
|
+
sensitivity: number;
|
|
9
|
+
allow: jest.Mock<any, any>;
|
|
10
|
+
bump: jest.Mock<any, any>;
|
|
11
|
+
constructor(appObject: AppObject);
|
|
12
|
+
}
|
|
@@ -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,13 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { AppObject } from "../../../AppObject";
|
|
3
|
+
import { PinchTransformUC } from "../UC";
|
|
4
|
+
export declare class MockPinchTransformUC extends PinchTransformUC {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
sensitivity: number;
|
|
7
|
+
minScale?: number | undefined;
|
|
8
|
+
maxScale?: number | undefined;
|
|
9
|
+
doPinch: jest.Mock<any, any>;
|
|
10
|
+
initializePinch: jest.Mock<any, any>;
|
|
11
|
+
finishPinch: jest.Mock<any, any>;
|
|
12
|
+
constructor(appObject: AppObject);
|
|
13
|
+
}
|
|
@@ -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,17 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { AppObject } from "../../../AppObject";
|
|
3
|
+
import { RayPanScaleTransformUC } from "../UC";
|
|
4
|
+
export declare class MockRayPanScaleTransformUC extends RayPanScaleTransformUC {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
sensitivity: number;
|
|
7
|
+
minScale?: number | undefined;
|
|
8
|
+
maxScale?: number | undefined;
|
|
9
|
+
minX?: number | undefined;
|
|
10
|
+
maxX?: number | undefined;
|
|
11
|
+
minY?: number | undefined;
|
|
12
|
+
maxY?: number | undefined;
|
|
13
|
+
update: jest.Mock<any, any>;
|
|
14
|
+
initialize: jest.Mock<any, any>;
|
|
15
|
+
finish: jest.Mock<any, any>;
|
|
16
|
+
constructor(appObject: AppObject);
|
|
17
|
+
}
|
|
@@ -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,16 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { AppObject } from "../../../AppObject";
|
|
3
|
+
import { ScaleTransformUC } from "../UC";
|
|
4
|
+
export declare class MockRayScaleTransform extends ScaleTransformUC {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
pixelSensitivity: number;
|
|
7
|
+
raySensitivity: number;
|
|
8
|
+
minScale?: number | undefined;
|
|
9
|
+
maxScale?: number | undefined;
|
|
10
|
+
updateRay: jest.Mock<any, any>;
|
|
11
|
+
initializeRay: jest.Mock<any, any>;
|
|
12
|
+
finish: jest.Mock<any, any>;
|
|
13
|
+
initializePixel: jest.Mock<any, any>;
|
|
14
|
+
updatePixel: jest.Mock<any, any>;
|
|
15
|
+
constructor(appObject: AppObject);
|
|
16
|
+
}
|
|
@@ -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,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,12 @@
|
|
|
1
|
+
import { AppObject, AppObjectUC } from "../../../AppObject";
|
|
2
|
+
import { 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 enabled: boolean;
|
|
9
|
+
abstract allow(): boolean;
|
|
10
|
+
abstract bump(direction: "IN" | "OUT", pixelPosition: Vector2): void;
|
|
11
|
+
}
|
|
12
|
+
export declare function makeBumpTransformScaleAboutPixelPointUC(appObject: AppObject): BumpTransformScaleAboutPixelPointUC;
|
|
@@ -0,0 +1,67 @@
|
|
|
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;
|
|
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
|
+
const pick = Babylon_1.scenePixelPick(pixelPosition, this.appObjects);
|
|
40
|
+
const pickPoint = (_a = pick === null || pick === void 0 ? void 0 : pick.worldPickPoint) !== null && _a !== void 0 ? _a : ValueObjects_1.Vector3.Zero();
|
|
41
|
+
this.bumpScaleAboutPoint(scaleDelta, pickPoint);
|
|
42
|
+
Dispatcher_1.dispatchStateChange(this.appObjects);
|
|
43
|
+
};
|
|
44
|
+
this.bumpScaleAboutPoint = (amount, worldPoint) => {
|
|
45
|
+
if (!this.transform)
|
|
46
|
+
return;
|
|
47
|
+
const localPickOffset = this.transform.worldPointToLocal(worldPoint);
|
|
48
|
+
const currentScale = this.transform.worldScale.x;
|
|
49
|
+
let newScale = currentScale + amount;
|
|
50
|
+
if (this.minScale !== undefined && newScale < this.minScale) {
|
|
51
|
+
newScale = this.minScale;
|
|
52
|
+
}
|
|
53
|
+
if (this.maxScale !== undefined && newScale > this.maxScale) {
|
|
54
|
+
newScale = this.maxScale;
|
|
55
|
+
}
|
|
56
|
+
this.transform.worldScale = new ValueObjects_1.Vector3(newScale, newScale, newScale);
|
|
57
|
+
const worldPickOffset = this.transform.localPointToWorld(localPickOffset);
|
|
58
|
+
const bump = ValueObjects_1.Vector3.Subtract(worldPoint, worldPickOffset);
|
|
59
|
+
this.transform.worldPosition = ValueObjects_1.Vector3.Add(bump, this.transform.worldPosition);
|
|
60
|
+
};
|
|
61
|
+
this.transform = appObject.getComponent(Entities_1.Transform3D.type);
|
|
62
|
+
if (!this.transform) {
|
|
63
|
+
this.error("BumpSceneRootScaleAboutPixelPointImp UC has been added to an App Object that does not have a Transform");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -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;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makePanTransformUC = exports.PanTransformUC = 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 PanTransformUC extends AppObject_1.AppObjectUC {
|
|
10
|
+
}
|
|
11
|
+
exports.PanTransformUC = PanTransformUC;
|
|
12
|
+
PanTransformUC.type = "PanTransformUC";
|
|
13
|
+
function makePanTransformUC(appObject) {
|
|
14
|
+
return new PanTransformUCImp(appObject);
|
|
15
|
+
}
|
|
16
|
+
exports.makePanTransformUC = makePanTransformUC;
|
|
17
|
+
class PanTransformUCImp extends PanTransformUC {
|
|
18
|
+
constructor(appObject) {
|
|
19
|
+
super(appObject, PanTransformUC.type);
|
|
20
|
+
this.enabled = true;
|
|
21
|
+
this.panPlane = ValueObjects_1.ParametricPlane.XY();
|
|
22
|
+
this.dispatchStateChangeOnComplete = true;
|
|
23
|
+
this.pickOffset = ValueObjects_1.Vector3.Zero();
|
|
24
|
+
this.initialPosition = ValueObjects_1.Vector3.Zero();
|
|
25
|
+
this.hasBeenInitialized = false;
|
|
26
|
+
this.initializePixel = (initialPixelPos) => {
|
|
27
|
+
const ray = Babylon_1.pixelToSceneRay(initialPixelPos, this.appObjects);
|
|
28
|
+
this.initializeRay(ray);
|
|
29
|
+
};
|
|
30
|
+
this.updatePixel = (pixelPosition) => {
|
|
31
|
+
if (!this.enabled)
|
|
32
|
+
return;
|
|
33
|
+
const pickRay = Babylon_1.pixelToSceneRay(pixelPosition, this.appObjects);
|
|
34
|
+
this.updateRay(pickRay);
|
|
35
|
+
};
|
|
36
|
+
this.initializeRay = (ray) => {
|
|
37
|
+
var _a;
|
|
38
|
+
if (!this.transformNode)
|
|
39
|
+
return;
|
|
40
|
+
const pick = (_a = this.panPlane.intersectLine(ray)) !== null && _a !== void 0 ? _a : ValueObjects_1.Vector3.Zero();
|
|
41
|
+
const rootPos = this.transformNode.worldPosition;
|
|
42
|
+
this.pickOffset = ValueObjects_1.Vector3.Subtract(rootPos, pick);
|
|
43
|
+
this.hasBeenInitialized = true;
|
|
44
|
+
this.initialPosition = this.transformNode.worldPosition;
|
|
45
|
+
};
|
|
46
|
+
this.updateRay = (ray) => {
|
|
47
|
+
var _a;
|
|
48
|
+
if (!this.transformNode)
|
|
49
|
+
return;
|
|
50
|
+
if (!this.hasBeenInitialized)
|
|
51
|
+
return;
|
|
52
|
+
if (!this.enabled)
|
|
53
|
+
return;
|
|
54
|
+
const pick = (_a = this.panPlane.intersectLine(ray)) !== null && _a !== void 0 ? _a : ValueObjects_1.Vector3.Zero();
|
|
55
|
+
let wPos = ValueObjects_1.Vector3.Add(pick, this.pickOffset);
|
|
56
|
+
if (this.minX !== undefined && wPos.x < this.minX) {
|
|
57
|
+
wPos = new ValueObjects_1.Vector3(this.minX, wPos.y, wPos.z);
|
|
58
|
+
}
|
|
59
|
+
if (this.maxX !== undefined && wPos.x > this.maxX) {
|
|
60
|
+
wPos = new ValueObjects_1.Vector3(this.maxX, wPos.y, wPos.z);
|
|
61
|
+
}
|
|
62
|
+
if (this.minY !== undefined && wPos.y < this.minY) {
|
|
63
|
+
wPos = new ValueObjects_1.Vector3(wPos.x, this.minY, wPos.z);
|
|
64
|
+
}
|
|
65
|
+
if (this.maxY !== undefined && wPos.y > this.maxY) {
|
|
66
|
+
wPos = new ValueObjects_1.Vector3(wPos.x, this.maxY, wPos.z);
|
|
67
|
+
}
|
|
68
|
+
this.transformNode.worldPosition = wPos;
|
|
69
|
+
};
|
|
70
|
+
this.finish = () => {
|
|
71
|
+
var _a;
|
|
72
|
+
if (!this.transformNode)
|
|
73
|
+
return;
|
|
74
|
+
if (!this.hasBeenInitialized)
|
|
75
|
+
return;
|
|
76
|
+
if (!this.enabled)
|
|
77
|
+
return;
|
|
78
|
+
this.hasBeenInitialized = false;
|
|
79
|
+
if (ValueObjects_1.Vector3.Equal(this.initialPosition, (_a = this.transformNode) === null || _a === void 0 ? void 0 : _a.worldPosition))
|
|
80
|
+
return;
|
|
81
|
+
if (this.dispatchStateChangeOnComplete) {
|
|
82
|
+
Dispatcher_1.dispatchStateChange(this.appObjects);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
this.cancelPan = () => {
|
|
86
|
+
this.hasBeenInitialized = false;
|
|
87
|
+
};
|
|
88
|
+
this.transformNode = appObject.getComponent(Entities_1.Transform3D.type);
|
|
89
|
+
if (!this.transformNode) {
|
|
90
|
+
this.error("App Object does not have a Transform3D");
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AppObject, AppObjectUC } from "../../../AppObject";
|
|
2
|
+
import { Vector2 } from "../../../ValueObjects";
|
|
3
|
+
export declare abstract class PinchTransformUC extends AppObjectUC {
|
|
4
|
+
static readonly type = "PinchTransformUC";
|
|
5
|
+
abstract sensitivity: number;
|
|
6
|
+
abstract enabled: boolean;
|
|
7
|
+
abstract minScale?: number;
|
|
8
|
+
abstract maxScale?: number;
|
|
9
|
+
abstract doPinch: (touchPos1: Vector2, touchPos2: Vector2) => void;
|
|
10
|
+
abstract initializePinch: (touchPos1: Vector2, touchPos2: Vector2) => void;
|
|
11
|
+
abstract finishPinch: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function makePinchTransformUC(appObject: AppObject): PinchTransformUC;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makePinchTransformUC = exports.PinchTransformUC = 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 PinchTransformUC extends AppObject_1.AppObjectUC {
|
|
10
|
+
}
|
|
11
|
+
exports.PinchTransformUC = PinchTransformUC;
|
|
12
|
+
PinchTransformUC.type = "PinchTransformUC";
|
|
13
|
+
function makePinchTransformUC(appObject) {
|
|
14
|
+
return new PinchTransformUCImp(appObject);
|
|
15
|
+
}
|
|
16
|
+
exports.makePinchTransformUC = makePinchTransformUC;
|
|
17
|
+
class PinchTransformUCImp extends PinchTransformUC {
|
|
18
|
+
constructor(appObject) {
|
|
19
|
+
super(appObject, PinchTransformUC.type);
|
|
20
|
+
this.sensitivity = 0.01;
|
|
21
|
+
this.enabled = true;
|
|
22
|
+
this.previousDistanceBetweenTouches = 0;
|
|
23
|
+
this.panPlane = ValueObjects_1.ParametricPlane.XY();
|
|
24
|
+
this.pickOffset = ValueObjects_1.Vector3.Zero();
|
|
25
|
+
this.initialScale = 0;
|
|
26
|
+
this.initializePinch = (touchPos1, touchPos2) => {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
if (!this.transform)
|
|
29
|
+
return;
|
|
30
|
+
this.previousDistanceBetweenTouches = this.getTouchDistance(touchPos1, touchPos2);
|
|
31
|
+
const touchCenter = this.getTouchCenter(touchPos1, touchPos2);
|
|
32
|
+
const scenePick = Babylon_1.scenePixelPick(touchCenter, this.appObjects);
|
|
33
|
+
const pickPoint = (_a = scenePick === null || scenePick === void 0 ? void 0 : scenePick.worldPickPoint) !== null && _a !== void 0 ? _a : ValueObjects_1.Vector3.Zero();
|
|
34
|
+
const pickPlaneDirection = ValueObjects_1.Vector3.Backward();
|
|
35
|
+
this.panPlane = ValueObjects_1.ParametricPlane.FromPointNormal(pickPoint, pickPlaneDirection);
|
|
36
|
+
const pickRay = Babylon_1.pixelToSceneRay(touchCenter, this.appObjects);
|
|
37
|
+
const planePick = (_b = this.panPlane.intersectLine(pickRay)) !== null && _b !== void 0 ? _b : ValueObjects_1.Vector3.Zero();
|
|
38
|
+
this.pickOffset = this.transform.worldPointToLocal(planePick);
|
|
39
|
+
this.initialScale = this.transform.worldScale.x;
|
|
40
|
+
};
|
|
41
|
+
this.doPinch = (touchPos1, touchPos2) => {
|
|
42
|
+
var _a;
|
|
43
|
+
if (!this.enabled)
|
|
44
|
+
return;
|
|
45
|
+
if (!this.transform)
|
|
46
|
+
return;
|
|
47
|
+
const currentTouchDist = this.getTouchDistance(touchPos1, touchPos2);
|
|
48
|
+
const touchDelta = currentTouchDist - this.previousDistanceBetweenTouches;
|
|
49
|
+
const currentScale = this.transform.worldScale.x;
|
|
50
|
+
const scaleDelta = touchDelta * this.sensitivity * currentScale;
|
|
51
|
+
let newScale = currentScale + scaleDelta;
|
|
52
|
+
if (this.minScale !== undefined && newScale < this.minScale) {
|
|
53
|
+
newScale = this.minScale;
|
|
54
|
+
}
|
|
55
|
+
if (this.maxScale !== undefined && newScale > this.maxScale) {
|
|
56
|
+
newScale = this.maxScale;
|
|
57
|
+
}
|
|
58
|
+
this.transform.worldScale = new ValueObjects_1.Vector3(newScale, newScale, newScale);
|
|
59
|
+
const touchCenter = this.getTouchCenter(touchPos1, touchPos2);
|
|
60
|
+
const pickRay = Babylon_1.pixelToSceneRay(touchCenter, this.appObjects);
|
|
61
|
+
const planePick = (_a = this.panPlane.intersectLine(pickRay)) !== null && _a !== void 0 ? _a : ValueObjects_1.Vector3.Zero();
|
|
62
|
+
const globalOffset = this.transform.localPointToWorld(this.pickOffset);
|
|
63
|
+
const delta = ValueObjects_1.Vector3.Subtract(planePick, globalOffset);
|
|
64
|
+
const currentWorldPos = this.transform.worldPosition;
|
|
65
|
+
const newWorldPos = ValueObjects_1.Vector3.Add(currentWorldPos, delta);
|
|
66
|
+
this.transform.worldPosition = newWorldPos;
|
|
67
|
+
this.previousDistanceBetweenTouches = currentTouchDist;
|
|
68
|
+
};
|
|
69
|
+
this.finishPinch = () => {
|
|
70
|
+
var _a;
|
|
71
|
+
if (this.initialScale === ((_a = this.transform) === null || _a === void 0 ? void 0 : _a.worldScale.x))
|
|
72
|
+
return;
|
|
73
|
+
Dispatcher_1.dispatchStateChange(this.appObjects);
|
|
74
|
+
};
|
|
75
|
+
this.transform = appObject.getComponent(Entities_1.Transform3D.type);
|
|
76
|
+
if (!this.transform) {
|
|
77
|
+
this.warn("PinchSceneRootUC UC has been added to an App Object that does not have a Transform3D");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
getTouchCenter(t1, t2) {
|
|
82
|
+
const delta = ValueObjects_1.Vector2.Subtract(t2, t1);
|
|
83
|
+
const halfDelta = ValueObjects_1.Vector2.NewVectorOfLength(delta.unit, 0.5 * delta.magnitued);
|
|
84
|
+
return ValueObjects_1.Vector2.Add(t1, halfDelta);
|
|
85
|
+
}
|
|
86
|
+
getTouchDistance(t1, t2) {
|
|
87
|
+
const delta = ValueObjects_1.Vector2.Subtract(t2, t1);
|
|
88
|
+
return delta.magnitued;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AppObject, AppObjectUC } from "../../../AppObject";
|
|
2
|
+
import { ParametricLine } from "../../../ValueObjects";
|
|
3
|
+
export declare abstract class RayPanScaleTransformUC extends AppObjectUC {
|
|
4
|
+
static readonly type = "RayPanScaleTransformUC";
|
|
5
|
+
abstract sensitivity: number;
|
|
6
|
+
abstract enabled: boolean;
|
|
7
|
+
abstract minScale?: number;
|
|
8
|
+
abstract maxScale?: number;
|
|
9
|
+
abstract minX?: number;
|
|
10
|
+
abstract maxX?: number;
|
|
11
|
+
abstract minY?: number;
|
|
12
|
+
abstract maxY?: number;
|
|
13
|
+
abstract update: (ray: ParametricLine) => void;
|
|
14
|
+
abstract initialize: (ray: ParametricLine) => void;
|
|
15
|
+
abstract finish: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function makeRayPanScaleTransformUC(appObject: AppObject): RayPanScaleTransformUC;
|