@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,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeRayPanScaleTransformUC = exports.RayPanScaleTransformUC = 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 RayPanScaleTransformUC extends AppObject_1.AppObjectUC {
|
|
10
|
+
}
|
|
11
|
+
exports.RayPanScaleTransformUC = RayPanScaleTransformUC;
|
|
12
|
+
RayPanScaleTransformUC.type = "RayPanScaleTransformUC";
|
|
13
|
+
function makeRayPanScaleTransformUC(appObject) {
|
|
14
|
+
return new RayPanScaleTransformUCImp(appObject);
|
|
15
|
+
}
|
|
16
|
+
exports.makeRayPanScaleTransformUC = makeRayPanScaleTransformUC;
|
|
17
|
+
class RayPanScaleTransformUCImp extends RayPanScaleTransformUC {
|
|
18
|
+
constructor(appObject) {
|
|
19
|
+
super(appObject, RayPanScaleTransformUC.type);
|
|
20
|
+
this.enabled = true;
|
|
21
|
+
this.sensitivity = 1;
|
|
22
|
+
this.allowUpdate = false;
|
|
23
|
+
this.initialScale = 1;
|
|
24
|
+
this.pickOffset = ValueObjects_1.Vector3.Zero();
|
|
25
|
+
this.panPlane = ValueObjects_1.ParametricPlane.XY();
|
|
26
|
+
this.lastRayLength = 0;
|
|
27
|
+
this.initialize = (ray) => {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
this.allowUpdate = false;
|
|
30
|
+
if (!this.transform)
|
|
31
|
+
return;
|
|
32
|
+
const pick = Babylon_1.sceneRayPick(ray, this.appObjects);
|
|
33
|
+
this.panPlane = ValueObjects_1.ParametricPlane.FromPointNormal((_a = pick === null || pick === void 0 ? void 0 : pick.worldPickPoint) !== null && _a !== void 0 ? _a : ValueObjects_1.Vector3.Zero(), ValueObjects_1.Vector3.Backward());
|
|
34
|
+
const pickPoint = (_b = this.panPlane.intersectLine(ray)) !== null && _b !== void 0 ? _b : ValueObjects_1.Vector3.Zero();
|
|
35
|
+
this.lastRayLength = ValueObjects_1.ParametricLine.GetDistanceToPoint(ray, pickPoint);
|
|
36
|
+
this.pickOffset = this.transform.worldPointToLocal(pickPoint);
|
|
37
|
+
this.initialScale = this.transform.worldScale.x;
|
|
38
|
+
this.allowUpdate = true;
|
|
39
|
+
};
|
|
40
|
+
this.update = (ray) => {
|
|
41
|
+
var _a;
|
|
42
|
+
if (!this.enabled)
|
|
43
|
+
return;
|
|
44
|
+
if (!this.allowUpdate)
|
|
45
|
+
return;
|
|
46
|
+
if (!this.transform)
|
|
47
|
+
return;
|
|
48
|
+
const pick = (_a = this.panPlane.intersectLine(ray)) !== null && _a !== void 0 ? _a : ValueObjects_1.Vector3.Zero();
|
|
49
|
+
this.updateScale(ray, pick);
|
|
50
|
+
this.updatePosition(pick);
|
|
51
|
+
};
|
|
52
|
+
this.finish = () => {
|
|
53
|
+
if (!this.transform)
|
|
54
|
+
return;
|
|
55
|
+
if (!this.allowUpdate)
|
|
56
|
+
return;
|
|
57
|
+
if (this.initialScale !== this.transform.worldScale.x) {
|
|
58
|
+
Dispatcher_1.dispatchStateChange(this.appObjects);
|
|
59
|
+
}
|
|
60
|
+
this.allowUpdate = false;
|
|
61
|
+
};
|
|
62
|
+
this.transform = appObject.getComponent(Entities_1.Transform3D.type);
|
|
63
|
+
if (!this.transform) {
|
|
64
|
+
this.error("App Object does not have a Transform3D Entity");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
updatePosition(pick) {
|
|
68
|
+
if (!this.transform)
|
|
69
|
+
return;
|
|
70
|
+
const originalPickOffset = this.transform.localPointToWorld(this.pickOffset);
|
|
71
|
+
const movement = ValueObjects_1.Vector3.Subtract(pick, originalPickOffset);
|
|
72
|
+
let wPos = ValueObjects_1.Vector3.Add(movement, this.transform.worldPosition);
|
|
73
|
+
if (this.minX !== undefined && wPos.x < this.minX) {
|
|
74
|
+
wPos = new ValueObjects_1.Vector3(this.minX, wPos.y, wPos.z);
|
|
75
|
+
}
|
|
76
|
+
if (this.maxX !== undefined && wPos.x > this.maxX) {
|
|
77
|
+
wPos = new ValueObjects_1.Vector3(this.maxX, wPos.y, wPos.z);
|
|
78
|
+
}
|
|
79
|
+
if (this.minY !== undefined && wPos.y < this.minY) {
|
|
80
|
+
wPos = new ValueObjects_1.Vector3(wPos.x, this.minY, wPos.z);
|
|
81
|
+
}
|
|
82
|
+
if (this.maxY !== undefined && wPos.y > this.maxY) {
|
|
83
|
+
wPos = new ValueObjects_1.Vector3(wPos.x, this.maxY, wPos.z);
|
|
84
|
+
}
|
|
85
|
+
this.transform.worldPosition = wPos;
|
|
86
|
+
}
|
|
87
|
+
updateScale(ray, pick) {
|
|
88
|
+
if (!this.transform)
|
|
89
|
+
return;
|
|
90
|
+
const rayLength = ValueObjects_1.ParametricLine.GetDistanceToPoint(ray, pick);
|
|
91
|
+
const rayDelta = rayLength - this.lastRayLength;
|
|
92
|
+
const localPickOffset = this.transform.worldPointToLocal(pick);
|
|
93
|
+
const currentScale = this.transform.worldScale.x;
|
|
94
|
+
const scaleDelta = rayDelta * this.sensitivity * currentScale;
|
|
95
|
+
let newScale = currentScale + scaleDelta;
|
|
96
|
+
if (this.minScale !== undefined && newScale < this.minScale) {
|
|
97
|
+
newScale = this.minScale;
|
|
98
|
+
}
|
|
99
|
+
if (this.maxScale !== undefined && newScale > this.maxScale) {
|
|
100
|
+
newScale = this.maxScale;
|
|
101
|
+
}
|
|
102
|
+
this.transform.worldScale = new ValueObjects_1.Vector3(newScale, newScale, newScale);
|
|
103
|
+
const worldPickOffset = this.transform.localPointToWorld(localPickOffset);
|
|
104
|
+
const bump = ValueObjects_1.Vector3.Subtract(pick, worldPickOffset);
|
|
105
|
+
this.transform.worldPosition = ValueObjects_1.Vector3.Add(bump, this.transform.worldPosition);
|
|
106
|
+
this.lastRayLength = rayLength;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AppObject, AppObjectUC } from "../../../AppObject";
|
|
2
|
+
import { ParametricLine, Vector2 } from "../../../ValueObjects";
|
|
3
|
+
export declare abstract class ScaleTransformUC extends AppObjectUC {
|
|
4
|
+
static readonly type = "ScaleTransformUC";
|
|
5
|
+
abstract raySensitivity: number;
|
|
6
|
+
abstract pixelSensitivity: number;
|
|
7
|
+
abstract enabled: boolean;
|
|
8
|
+
abstract minScale?: number;
|
|
9
|
+
abstract maxScale?: number;
|
|
10
|
+
abstract initializeRay: (ray: ParametricLine) => void;
|
|
11
|
+
abstract updateRay: (ray: ParametricLine) => void;
|
|
12
|
+
abstract initializePixel: (pixel: Vector2) => void;
|
|
13
|
+
abstract updatePixel: (pixel: Vector2) => void;
|
|
14
|
+
abstract finish: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function makeScaleTransformUC(appObject: AppObject): ScaleTransformUC;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeScaleTransformUC = exports.ScaleTransformUC = 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 ScaleTransformUC extends AppObject_1.AppObjectUC {
|
|
10
|
+
}
|
|
11
|
+
exports.ScaleTransformUC = ScaleTransformUC;
|
|
12
|
+
ScaleTransformUC.type = "ScaleTransformUC";
|
|
13
|
+
function makeScaleTransformUC(appObject) {
|
|
14
|
+
return new ScaleTransformUCImp(appObject);
|
|
15
|
+
}
|
|
16
|
+
exports.makeScaleTransformUC = makeScaleTransformUC;
|
|
17
|
+
class ScaleTransformUCImp extends ScaleTransformUC {
|
|
18
|
+
constructor(appObject) {
|
|
19
|
+
super(appObject, ScaleTransformUC.type);
|
|
20
|
+
this.raySensitivity = 1;
|
|
21
|
+
this.pixelSensitivity = 0.1;
|
|
22
|
+
this.enabled = true;
|
|
23
|
+
this.lastPosition = 0;
|
|
24
|
+
this.pickPoint = ValueObjects_1.Vector3.Zero();
|
|
25
|
+
this.initialScale = 1;
|
|
26
|
+
this.isScaling = false;
|
|
27
|
+
this.initializeRay = (ray) => {
|
|
28
|
+
this.lastPosition = ray.origin.z;
|
|
29
|
+
this.doInitialize(ray);
|
|
30
|
+
};
|
|
31
|
+
this.updateRay = (ray) => {
|
|
32
|
+
if (!this.isScaling)
|
|
33
|
+
return;
|
|
34
|
+
if (!this.transform)
|
|
35
|
+
return;
|
|
36
|
+
if (!this.enabled)
|
|
37
|
+
return;
|
|
38
|
+
const movement = this.lastPosition - ray.origin.z;
|
|
39
|
+
const currentScale = this.transform.worldScale.x;
|
|
40
|
+
const scaleDelta = movement * this.raySensitivity * currentScale;
|
|
41
|
+
this.bumpScaleAboutPoint(scaleDelta, this.pickPoint);
|
|
42
|
+
this.lastPosition = ray.origin.z;
|
|
43
|
+
};
|
|
44
|
+
this.initializePixel = (initialPixelPos) => {
|
|
45
|
+
this.lastPosition = initialPixelPos.y;
|
|
46
|
+
const ray = Babylon_1.pixelToSceneRay(initialPixelPos, this.appObjects);
|
|
47
|
+
this.doInitialize(ray);
|
|
48
|
+
};
|
|
49
|
+
this.updatePixel = (pixelPosition) => {
|
|
50
|
+
if (!this.enabled)
|
|
51
|
+
return;
|
|
52
|
+
if (!this.transform)
|
|
53
|
+
return;
|
|
54
|
+
if (!this.isScaling)
|
|
55
|
+
return;
|
|
56
|
+
const pixelChange = pixelPosition.y - this.lastPosition;
|
|
57
|
+
this.lastPosition = pixelPosition.y;
|
|
58
|
+
const currentScale = this.transform.worldScale.x;
|
|
59
|
+
const scaleDelta = pixelChange * this.pixelSensitivity * currentScale;
|
|
60
|
+
this.bumpScaleAboutPoint(scaleDelta, this.pickPoint);
|
|
61
|
+
};
|
|
62
|
+
this.finish = () => {
|
|
63
|
+
if (!this.transform)
|
|
64
|
+
return;
|
|
65
|
+
if (!this.isScaling)
|
|
66
|
+
return;
|
|
67
|
+
if (this.initialScale !== this.transform.worldScale.x) {
|
|
68
|
+
Dispatcher_1.dispatchStateChange(this.appObjects);
|
|
69
|
+
}
|
|
70
|
+
this.isScaling = false;
|
|
71
|
+
};
|
|
72
|
+
this.bumpScaleAboutPoint = (amount, worldPoint) => {
|
|
73
|
+
if (!this.transform)
|
|
74
|
+
return;
|
|
75
|
+
const localPickOffset = this.transform.worldPointToLocal(worldPoint);
|
|
76
|
+
const currentScale = this.transform.worldScale.x;
|
|
77
|
+
let newScale = currentScale + amount;
|
|
78
|
+
if (this.minScale !== undefined && newScale < this.minScale) {
|
|
79
|
+
newScale = this.minScale;
|
|
80
|
+
}
|
|
81
|
+
if (this.maxScale !== undefined && newScale > this.maxScale) {
|
|
82
|
+
newScale = this.maxScale;
|
|
83
|
+
}
|
|
84
|
+
this.transform.worldScale = new ValueObjects_1.Vector3(newScale, newScale, newScale);
|
|
85
|
+
const worldPickOffset = this.transform.localPointToWorld(localPickOffset);
|
|
86
|
+
const bump = ValueObjects_1.Vector3.Subtract(worldPoint, worldPickOffset);
|
|
87
|
+
this.transform.worldPosition = ValueObjects_1.Vector3.Add(bump, this.transform.worldPosition);
|
|
88
|
+
};
|
|
89
|
+
this.transform = appObject.getComponent(Entities_1.Transform3D.type);
|
|
90
|
+
if (!this.transform) {
|
|
91
|
+
this.error("App Object does not have a Transform3D Entity");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
doInitialize(ray) {
|
|
95
|
+
var _a;
|
|
96
|
+
this.isScaling = false;
|
|
97
|
+
if (!this.transform)
|
|
98
|
+
return;
|
|
99
|
+
const pick = Babylon_1.sceneRayPick(ray, this.appObjects);
|
|
100
|
+
this.pickPoint = (_a = pick === null || pick === void 0 ? void 0 : pick.worldPickPoint) !== null && _a !== void 0 ? _a : ValueObjects_1.Vector3.Zero();
|
|
101
|
+
this.initialScale = this.transform.worldScale.x;
|
|
102
|
+
this.isScaling = true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export * from "./BumpTransformScaleAboutPixelPoint";
|
|
1
2
|
export * from "./DragTransformUC";
|
|
3
|
+
export * from "./MoveTransformUndoRedo";
|
|
4
|
+
export * from "./PanTransformUC";
|
|
5
|
+
export * from "./PinchTransform";
|
|
6
|
+
export * from "./RayPanScaleTransform";
|
|
7
|
+
export * from "./ScaleTransform";
|
|
2
8
|
export * from "./StickTransformUC";
|
|
3
9
|
export * from "./StylusMoveTransformUC";
|
|
@@ -10,6 +10,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./BumpTransformScaleAboutPixelPoint"), exports);
|
|
13
14
|
__exportStar(require("./DragTransformUC"), exports);
|
|
15
|
+
__exportStar(require("./MoveTransformUndoRedo"), exports);
|
|
16
|
+
__exportStar(require("./PanTransformUC"), exports);
|
|
17
|
+
__exportStar(require("./PinchTransform"), exports);
|
|
18
|
+
__exportStar(require("./RayPanScaleTransform"), exports);
|
|
19
|
+
__exportStar(require("./ScaleTransform"), exports);
|
|
14
20
|
__exportStar(require("./StickTransformUC"), exports);
|
|
15
21
|
__exportStar(require("./StylusMoveTransformUC"), exports);
|
|
@@ -10,6 +10,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./Controllers"), exports);
|
|
13
14
|
__exportStar(require("./Entities"), exports);
|
|
15
|
+
__exportStar(require("./Mocks"), exports);
|
|
14
16
|
__exportStar(require("./UC"), exports);
|
|
15
17
|
__exportStar(require("./PM"), exports);
|