@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.
- package/lib/Components/HoverLabel/Controllers/StylusHoverLabel.d.ts +2 -2
- package/lib/Components/HoverLabel/Controllers/StylusHoverLabel.js +3 -3
- package/lib/Components/Question/Entities/QuestionAnswerEntity.d.ts +0 -1
- package/lib/Components/Question/Entities/QuestionAnswerEntity.js +2 -6
- package/lib/Components/RequestHandler/UC/StartZSpaceUC.js +12 -1
- package/lib/Components/RequestHandler/UC/StopZSpaceUC.js +20 -7
- package/lib/Components/SceneRoot/Controllers/ScaleSceneRootSC.d.ts +14 -0
- package/lib/Components/SceneRoot/Controllers/ScaleSceneRootSC.js +55 -0
- package/lib/Components/SceneRoot/Controllers/SceneRootMoveSC.d.ts +14 -0
- package/lib/Components/SceneRoot/Controllers/SceneRootMoveSC.js +53 -0
- package/lib/Components/SceneRoot/Controllers/index.d.ts +2 -2
- package/lib/Components/SceneRoot/Controllers/index.js +2 -2
- package/lib/Components/Selection/Controller/HoverOnAppObjectSC.d.ts +11 -0
- package/lib/Components/Selection/Controller/HoverOnAppObjectSC.js +41 -0
- package/lib/Components/Selection/Controller/PressOnAppObjectSC.d.ts +18 -0
- package/lib/Components/Selection/Controller/PressOnAppObjectSC.js +70 -0
- package/lib/Components/Selection/Controller/SelectAppObjectSC.d.ts +11 -0
- package/lib/Components/Selection/Controller/SelectAppObjectSC.js +39 -0
- package/lib/Components/Selection/Controller/index.d.ts +3 -3
- package/lib/Components/Selection/Controller/index.js +3 -3
- package/lib/Components/Stylus/Entity/StylusEntity.d.ts +21 -0
- package/lib/Components/Stylus/Entity/StylusEntity.js +104 -0
- package/lib/Components/Stylus/Entity/index.d.ts +1 -0
- package/lib/Components/Stylus/Entity/index.js +13 -0
- package/lib/Components/Stylus/Mocks/MockEmulateStylusUC.d.ts +10 -0
- package/lib/Components/Stylus/Mocks/MockEmulateStylusUC.js +19 -0
- package/lib/Components/Stylus/Mocks/index.d.ts +1 -0
- package/lib/Components/Stylus/Mocks/index.js +13 -0
- package/lib/Components/Stylus/PMs/StylusColorLengthPM.d.ts +14 -0
- package/lib/Components/Stylus/PMs/StylusColorLengthPM.js +81 -0
- package/lib/Components/Stylus/PMs/StylusIsInUsePM.d.ts +6 -0
- package/lib/Components/Stylus/PMs/StylusIsInUsePM.js +36 -0
- package/lib/Components/Stylus/PMs/index.d.ts +2 -0
- package/lib/Components/Stylus/PMs/index.js +14 -0
- package/lib/Components/Stylus/UCs/EmulateStylusUC.d.ts +9 -0
- package/lib/Components/Stylus/UCs/EmulateStylusUC.js +132 -0
- package/lib/Components/Stylus/UCs/index.d.ts +1 -0
- package/lib/Components/Stylus/UCs/index.js +13 -0
- package/lib/Components/Stylus/index.d.ts +4 -0
- package/lib/Components/Stylus/index.js +16 -0
- 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/StylusMoveTransformUC.js +14 -35
- 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/lib/Components/index.d.ts +5 -4
- package/lib/Components/index.js +5 -4
- package/lib/Components/zSpace/Entities/ZSpaceEntity.d.ts +0 -2
- package/lib/Components/zSpace/Entities/ZSpaceEntity.js +0 -3
- package/lib/Components/zSpace/Entities/index.d.ts +0 -1
- package/lib/Components/zSpace/Entities/index.js +0 -1
- package/lib/Components/zSpace/PM/index.d.ts +0 -2
- package/lib/Components/zSpace/PM/index.js +0 -2
- package/lib/Components/zSpace/UC/StylusFromGamepadHook.d.ts +2 -3
- package/lib/Components/zSpace/UC/StylusFromGamepadHook.js +14 -13
- package/lib/Components/zSpace/index.d.ts +0 -1
- package/lib/Components/zSpace/index.js +0 -1
- package/lib/Entities/TransformNode.d.ts +0 -55
- package/lib/ValueObjects/Color.js +1 -1
- package/lib/ValueObjects/ParametricLine.d.ts +3 -0
- package/lib/ValueObjects/ParametricLine.js +13 -3
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -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
|
+
}
|
|
@@ -5,8 +5,9 @@ const __1 = require("..");
|
|
|
5
5
|
const AppObjectUC_1 = require("../../../AppObject/AppObjectUC");
|
|
6
6
|
const ValueObjects_1 = require("../../../ValueObjects");
|
|
7
7
|
const Dispatcher_1 = require("../../Dispatcher");
|
|
8
|
+
const Stylus_1 = require("../../Stylus");
|
|
8
9
|
const UndoRedo_1 = require("../../UndoRedo");
|
|
9
|
-
const
|
|
10
|
+
const Entities_1 = require("../Entities");
|
|
10
11
|
const MoveTransformUndoRedo_1 = require("./MoveTransformUndoRedo");
|
|
11
12
|
class StylusMoveTransformUC extends AppObjectUC_1.AppObjectUC {
|
|
12
13
|
static get(appObject) {
|
|
@@ -33,8 +34,8 @@ class StylusMoveTransformUCImp extends StylusMoveTransformUC {
|
|
|
33
34
|
return;
|
|
34
35
|
if (!this.stylus)
|
|
35
36
|
return;
|
|
36
|
-
this.transform.worldPosition = this.
|
|
37
|
-
this.transform.worldRotation = this.
|
|
37
|
+
this.transform.worldPosition = this.helperTransform.worldPosition;
|
|
38
|
+
this.transform.worldRotation = this.helperTransform.worldRotation;
|
|
38
39
|
this.didMove = true;
|
|
39
40
|
};
|
|
40
41
|
this.stop = (registerUndo = false) => {
|
|
@@ -54,43 +55,21 @@ class StylusMoveTransformUCImp extends StylusMoveTransformUC {
|
|
|
54
55
|
this.isMoving = false;
|
|
55
56
|
this.didMove = false;
|
|
56
57
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
this.transform = __1.Transform3D.addIfMissing(this.appObject);
|
|
59
|
+
const helperAO = this.appObjects.getOrCreate(this.appObject.id + "_helper");
|
|
60
|
+
this.helperTransform = Entities_1.makeTransform3D(helperAO);
|
|
61
|
+
if (this.stylus) {
|
|
62
|
+
this.helperTransform.parent = this.stylus.transform;
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
get dispatchStateChange() {
|
|
65
|
-
|
|
66
|
-
this._cachedDispatchStateChange = Dispatcher_1.DispatchStateChangeUC.get(this.appObject.appObjectRepo);
|
|
67
|
-
if (!this._cachedDispatchStateChange) {
|
|
68
|
-
this.warn("Unable to find DispatchStateChangeUC");
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return this._cachedDispatchStateChange;
|
|
66
|
+
return this.getCachedSingleton(Dispatcher_1.DispatchStateChangeUC.type);
|
|
73
67
|
}
|
|
74
68
|
get undoRedoEntity() {
|
|
75
|
-
|
|
76
|
-
this._cachedUndoRedo = UndoRedo_1.UndoRedoEntity.get(this.appObject.appObjectRepo);
|
|
77
|
-
if (!this._cachedUndoRedo) {
|
|
78
|
-
this.warn("Unable to find UndoRedoEntity");
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return this._cachedUndoRedo;
|
|
69
|
+
return this.getCachedSingleton(UndoRedo_1.UndoRedoEntity.type);
|
|
83
70
|
}
|
|
84
71
|
get stylus() {
|
|
85
|
-
|
|
86
|
-
const zSpaceEntity = ZSpaceEntity_1.ZSpaceEntity.get(this.appObject.appObjectRepo);
|
|
87
|
-
if (!zSpaceEntity) {
|
|
88
|
-
this.warn("Unable to find ZSpaceEntity");
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
this._cachedStylus = zSpaceEntity.stylus;
|
|
92
|
-
}
|
|
93
|
-
return this._cachedStylus;
|
|
72
|
+
return this.getCachedSingleton(Stylus_1.StylusEntity.type);
|
|
94
73
|
}
|
|
95
74
|
initialize() {
|
|
96
75
|
if (!this.transform)
|
|
@@ -99,8 +78,8 @@ class StylusMoveTransformUCImp extends StylusMoveTransformUC {
|
|
|
99
78
|
return false;
|
|
100
79
|
this.initialPosition = this.transform.localPosition;
|
|
101
80
|
this.initialRotation = this.transform.localRotation;
|
|
102
|
-
this.
|
|
103
|
-
this.
|
|
81
|
+
this.helperTransform.worldPosition = this.transform.worldPosition;
|
|
82
|
+
this.helperTransform.worldRotation = this.transform.worldRotation;
|
|
104
83
|
this.isMoving = true;
|
|
105
84
|
return;
|
|
106
85
|
}
|
|
@@ -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";
|