@vived/app 4.28.2 → 4.30.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/ChannelModel/Adapters/index.d.ts +1 -0
- package/lib/Components/ChannelModel/Adapters/index.js +1 -0
- package/lib/Components/ChannelModel/Adapters/modelObjectsAreStickableAdapter.d.ts +2 -0
- package/lib/Components/ChannelModel/Adapters/modelObjectsAreStickableAdapter.js +27 -0
- package/lib/Components/ChannelModel/Controllers/index.d.ts +1 -0
- package/lib/Components/ChannelModel/Controllers/index.js +1 -0
- package/lib/Components/ChannelModel/Controllers/stickAllActiveObjects.d.ts +2 -0
- package/lib/Components/ChannelModel/Controllers/stickAllActiveObjects.js +23 -0
- package/lib/Components/ChannelModel/Mocks/ModelObjectsAreStickableMock.d.ts +7 -0
- package/lib/Components/ChannelModel/Mocks/ModelObjectsAreStickableMock.js +11 -0
- package/lib/Components/ChannelModel/Mocks/StickAllChannelModelObjectsUCMock.d.ts +9 -0
- package/lib/Components/ChannelModel/Mocks/StickAllChannelModelObjectsUCMock.js +13 -0
- package/lib/Components/ChannelModel/Mocks/index.d.ts +2 -0
- package/lib/Components/ChannelModel/Mocks/index.js +2 -0
- package/lib/Components/ChannelModel/PMs/ModelObjectsAreStickablePM.d.ts +6 -0
- package/lib/Components/ChannelModel/PMs/ModelObjectsAreStickablePM.js +56 -0
- package/lib/Components/ChannelModel/PMs/index.d.ts +1 -0
- package/lib/Components/ChannelModel/PMs/index.js +1 -0
- package/lib/Components/ChannelModel/UC/StickAllChannelModelObjectsUC.d.ts +7 -0
- package/lib/Components/ChannelModel/UC/StickAllChannelModelObjectsUC.js +87 -0
- package/lib/Components/ChannelModel/UC/index.d.ts +1 -0
- package/lib/Components/ChannelModel/UC/index.js +1 -0
- package/lib/Components/Environment/Adapters/environmentalIntensityAdapter.d.ts +2 -0
- package/lib/Components/Environment/Adapters/environmentalIntensityAdapter.js +19 -0
- package/lib/Components/Environment/Adapters/index.d.ts +2 -0
- package/lib/Components/Environment/Adapters/index.js +14 -0
- package/lib/Components/Environment/Adapters/texturalEnvironmentAdapter.d.ts +3 -0
- package/lib/Components/Environment/Adapters/texturalEnvironmentAdapter.js +20 -0
- package/lib/Components/Environment/Controllers/index.d.ts +3 -0
- package/lib/Components/Environment/Controllers/index.js +15 -0
- package/lib/Components/Environment/Controllers/setTexturalEnvironment.d.ts +3 -0
- package/lib/Components/Environment/Controllers/setTexturalEnvironment.js +13 -0
- package/lib/Components/Environment/Controllers/submitEnvironmentIntensity.d.ts +2 -0
- package/lib/Components/Environment/Controllers/submitEnvironmentIntensity.js +13 -0
- package/lib/Components/Environment/Controllers/updateEnvironmentIntensity.d.ts +2 -0
- package/lib/Components/Environment/Controllers/updateEnvironmentIntensity.js +13 -0
- package/lib/Components/Environment/Entities/Environment.d.ts +20 -0
- package/lib/Components/Environment/Entities/Environment.js +53 -0
- package/lib/Components/Environment/Entities/index.d.ts +1 -0
- package/lib/Components/Environment/Entities/index.js +13 -0
- package/lib/Components/Environment/Factories/index.d.ts +1 -0
- package/lib/Components/Environment/Factories/index.js +13 -0
- package/lib/Components/Environment/Factories/setupEnvironmnets.d.ts +2 -0
- package/lib/Components/Environment/Factories/setupEnvironmnets.js +19 -0
- package/lib/Components/Environment/Mocks/EnvironmentalIntensityPmMock.d.ts +8 -0
- package/lib/Components/Environment/Mocks/EnvironmentalIntensityPmMock.js +15 -0
- package/lib/Components/Environment/Mocks/SetEnvironmentIntensityUcMock.d.ts +9 -0
- package/lib/Components/Environment/Mocks/SetEnvironmentIntensityUcMock.js +16 -0
- package/lib/Components/Environment/Mocks/SetTexturalEnvironmentUcMock.d.ts +8 -0
- package/lib/Components/Environment/Mocks/SetTexturalEnvironmentUcMock.js +15 -0
- package/lib/Components/Environment/Mocks/TexturalEnvironmentPmMock.d.ts +8 -0
- package/lib/Components/Environment/Mocks/TexturalEnvironmentPmMock.js +15 -0
- package/lib/Components/Environment/Mocks/index.d.ts +4 -0
- package/lib/Components/Environment/Mocks/index.js +16 -0
- package/lib/Components/Environment/PMs/EnvironmentalIntensityPM.d.ts +6 -0
- package/lib/Components/Environment/PMs/EnvironmentalIntensityPM.js +34 -0
- package/lib/Components/Environment/PMs/TexturalEnvironmentPM.d.ts +7 -0
- package/lib/Components/Environment/PMs/TexturalEnvironmentPM.js +34 -0
- package/lib/Components/Environment/PMs/index.d.ts +2 -0
- package/lib/Components/Environment/PMs/index.js +14 -0
- package/lib/Components/Environment/UCs/SerializeEnvironment.d.ts +23 -0
- package/lib/Components/Environment/UCs/SerializeEnvironment.js +73 -0
- package/lib/Components/Environment/UCs/SetEnvironmentIntensityUC.d.ts +8 -0
- package/lib/Components/Environment/UCs/SetEnvironmentIntensityUC.js +69 -0
- package/lib/Components/Environment/UCs/SetTexturalEnvironmentUC.d.ts +8 -0
- package/lib/Components/Environment/UCs/SetTexturalEnvironmentUC.js +58 -0
- package/lib/Components/Environment/UCs/index.d.ts +3 -0
- package/lib/Components/Environment/UCs/index.js +15 -0
- package/lib/Components/Environment/index.d.ts +7 -0
- package/lib/Components/Environment/index.js +19 -0
- package/lib/Components/Stick/Adapters/index.d.ts +1 -0
- package/lib/Components/Stick/Adapters/index.js +13 -0
- package/lib/Components/Stick/Adapters/stickTargetAdapter.d.ts +3 -0
- package/lib/Components/Stick/Adapters/stickTargetAdapter.js +23 -0
- package/lib/Components/Stick/Controllers/DoubleClickToStickMC.d.ts +15 -0
- package/lib/Components/Stick/Controllers/DoubleClickToStickMC.js +57 -0
- package/lib/Components/Stick/Controllers/DoubleTapToStickTC.d.ts +15 -0
- package/lib/Components/Stick/Controllers/DoubleTapToStickTC.js +52 -0
- package/lib/Components/Stick/Controllers/clickStick.d.ts +2 -0
- package/lib/Components/Stick/Controllers/clickStick.js +13 -0
- package/lib/Components/Stick/Controllers/index.d.ts +3 -0
- package/lib/Components/Stick/Controllers/index.js +15 -0
- package/lib/Components/Stick/Entities/Stickable.d.ts +22 -0
- package/lib/Components/Stick/Entities/Stickable.js +101 -0
- package/lib/Components/Stick/Entities/index.d.ts +1 -0
- package/lib/Components/Stick/Entities/index.js +13 -0
- package/lib/Components/Stick/Factories/index.d.ts +1 -0
- package/lib/Components/Stick/Factories/index.js +13 -0
- package/lib/Components/Stick/Factories/setupStick.d.ts +2 -0
- package/lib/Components/Stick/Factories/setupStick.js +15 -0
- package/lib/Components/Stick/Mocks/StickTargetPmMock.d.ts +7 -0
- package/lib/Components/Stick/Mocks/StickTargetPmMock.js +11 -0
- package/lib/Components/Stick/Mocks/StickUCMock.d.ts +7 -0
- package/lib/Components/Stick/Mocks/StickUCMock.js +11 -0
- package/lib/Components/Stick/Mocks/TryStickAppObjectUCMock.d.ts +10 -0
- package/lib/Components/Stick/Mocks/TryStickAppObjectUCMock.js +17 -0
- package/lib/Components/Stick/Mocks/index.d.ts +3 -0
- package/lib/Components/Stick/Mocks/index.js +15 -0
- package/lib/Components/Stick/PMs/StickTargetPM.d.ts +11 -0
- package/lib/Components/Stick/PMs/StickTargetPM.js +50 -0
- package/lib/Components/Stick/PMs/index.d.ts +1 -0
- package/lib/Components/Stick/PMs/index.js +13 -0
- package/lib/Components/Stick/UCs/PanTransformWithStickUC.d.ts +3 -0
- package/lib/Components/Stick/UCs/PanTransformWithStickUC.js +131 -0
- package/lib/Components/Stick/UCs/StickUC.d.ts +7 -0
- package/lib/Components/Stick/UCs/StickUC.js +71 -0
- package/lib/Components/Stick/UCs/TryPickStickTarget.d.ts +8 -0
- package/lib/Components/Stick/UCs/TryPickStickTarget.js +26 -0
- package/lib/Components/Stick/UCs/TryStickAppObjectUC.d.ts +10 -0
- package/lib/Components/Stick/UCs/TryStickAppObjectUC.js +74 -0
- package/lib/Components/Stick/UCs/index.d.ts +4 -0
- package/lib/Components/Stick/UCs/index.js +16 -0
- package/lib/Components/Stick/index.d.ts +7 -0
- package/lib/Components/Stick/index.js +19 -0
- package/lib/Components/Stylus/Factories/index.d.ts +1 -0
- package/lib/Components/Stylus/Factories/index.js +13 -0
- package/lib/Components/Stylus/Factories/setupStylus.d.ts +2 -0
- package/lib/Components/Stylus/Factories/setupStylus.js +19 -0
- package/lib/Components/Stylus/index.d.ts +1 -0
- package/lib/Components/Stylus/index.js +1 -0
- package/lib/Components/Transform3D/UC/PanTransformUC.d.ts +28 -1
- package/lib/Components/Transform3D/UC/PanTransformUC.js +52 -34
- package/lib/Components/Transform3D/UC/TryPanTransformUC.d.ts +3 -2
- package/lib/Components/Transform3D/UC/index.d.ts +0 -1
- package/lib/Components/Transform3D/UC/index.js +0 -1
- package/lib/Components/index.d.ts +3 -1
- package/lib/Components/index.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makePanTransformWithStickUC = void 0;
|
|
4
|
+
const ValueObjects_1 = require("../../../ValueObjects");
|
|
5
|
+
const Transform3D_1 = require("../../Transform3D");
|
|
6
|
+
const Stickable_1 = require("../Entities/Stickable");
|
|
7
|
+
const TryPickStickTarget_1 = require("./TryPickStickTarget");
|
|
8
|
+
function makePanTransformWithStickUC(appObject) {
|
|
9
|
+
return new PanTransformWithStickUC(appObject);
|
|
10
|
+
}
|
|
11
|
+
exports.makePanTransformWithStickUC = makePanTransformWithStickUC;
|
|
12
|
+
class PanTransformWithStickUC extends Transform3D_1.PanTransformUCImp {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.isFirstPeel = true;
|
|
16
|
+
this.initialScale = ValueObjects_1.Vector3.Zero();
|
|
17
|
+
this.initialRot = ValueObjects_1.Quaternion.Identity();
|
|
18
|
+
this.initializeRay = (ray) => {
|
|
19
|
+
var _a;
|
|
20
|
+
if (!this.transformNode || !this.stickable || !this.pickTargetsUC) {
|
|
21
|
+
this.error("Missing components");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const pick = (_a = this.panPlane.intersectLine(ray)) !== null && _a !== void 0 ? _a : ValueObjects_1.Vector3.Zero();
|
|
25
|
+
const rootPos = this.transformNode.worldPosition;
|
|
26
|
+
this.pickOffset = ValueObjects_1.Vector3.Subtract(rootPos, pick);
|
|
27
|
+
this.initialScale = this.transformNode.localScale;
|
|
28
|
+
this.initialRot = this.transformNode.localRotation;
|
|
29
|
+
this.isFirstPeel = true;
|
|
30
|
+
this.hasBeenInitialized = true;
|
|
31
|
+
this.initialPosition = this.transformNode.localPosition;
|
|
32
|
+
};
|
|
33
|
+
this.updateRay = (ray) => {
|
|
34
|
+
var _a;
|
|
35
|
+
if (!this.transformNode || !this.stickable || !this.pickTargetsUC) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (!this.hasBeenInitialized)
|
|
39
|
+
return;
|
|
40
|
+
if (!this.enabled)
|
|
41
|
+
return;
|
|
42
|
+
const pick = (_a = this.panPlane.intersectLine(ray)) !== null && _a !== void 0 ? _a : ValueObjects_1.Vector3.Zero();
|
|
43
|
+
const wPos = ValueObjects_1.Vector3.Add(pick, this.pickOffset);
|
|
44
|
+
const clampedPos = this.enforceBoundaries(wPos);
|
|
45
|
+
this.transformNode.worldPosition = clampedPos;
|
|
46
|
+
const isHitStickTarget = this.pickTargetsUC.tryPick(ray);
|
|
47
|
+
if (isHitStickTarget) {
|
|
48
|
+
if (this.isFirstPeel) {
|
|
49
|
+
this.stickable.showStickTarget = false;
|
|
50
|
+
this.stickable.highlightTarget = false;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.stickable.showStickTarget = true;
|
|
54
|
+
this.stickable.highlightTarget = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.stickable.showStickTarget = true;
|
|
59
|
+
this.stickable.highlightTarget = false;
|
|
60
|
+
this.isFirstPeel = false;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
this.finish = () => {
|
|
64
|
+
if (!this.stickable) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (!this.hasBeenInitialized)
|
|
68
|
+
return;
|
|
69
|
+
if (!this.enabled)
|
|
70
|
+
return;
|
|
71
|
+
const doStick = this.stickable.highlightTarget;
|
|
72
|
+
this.hasBeenInitialized = false;
|
|
73
|
+
this.stickable.showStickTarget = false;
|
|
74
|
+
this.stickable.highlightTarget = false;
|
|
75
|
+
if (doStick) {
|
|
76
|
+
this.finishWithStick();
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.submitDispatchAndUndo();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
this.cancelPan = () => {
|
|
83
|
+
this.hasBeenInitialized = false;
|
|
84
|
+
if (this.stickable) {
|
|
85
|
+
this.stickable.showStickTarget = false;
|
|
86
|
+
this.stickable.highlightTarget = false;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
get stickable() {
|
|
91
|
+
return this.getCachedLocalComponent(Stickable_1.StickableEntity.type);
|
|
92
|
+
}
|
|
93
|
+
get pickTargetsUC() {
|
|
94
|
+
return this.getCachedLocalComponent(TryPickStickTarget_1.TryPickStickTargetUC.type);
|
|
95
|
+
}
|
|
96
|
+
finishWithStick() {
|
|
97
|
+
var _a;
|
|
98
|
+
const dispatch = this.dispatchStateChange;
|
|
99
|
+
const transform = this.transformNode;
|
|
100
|
+
if (!transform || !dispatch || !this.stickable)
|
|
101
|
+
return;
|
|
102
|
+
const startPos = this.initialPosition;
|
|
103
|
+
const finalPos = this.stickable.stickPosition;
|
|
104
|
+
const startRot = this.initialRot;
|
|
105
|
+
const finalRot = this.stickable.stickRotation;
|
|
106
|
+
const startScale = this.initialScale;
|
|
107
|
+
const finalScale = new ValueObjects_1.Vector3(this.stickable.stickScale, this.stickable.stickScale, this.stickable.stickScale);
|
|
108
|
+
if (this.dispatchStateChangeOnComplete) {
|
|
109
|
+
this.stickable.doStick(dispatch);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
this.stickable.doStick();
|
|
113
|
+
}
|
|
114
|
+
if (this.submitUndoOnComplete) {
|
|
115
|
+
(_a = this.undoRedo) === null || _a === void 0 ? void 0 : _a.submitAction({
|
|
116
|
+
undoAction: () => {
|
|
117
|
+
transform.localPosition = startPos;
|
|
118
|
+
transform.localRotation = startRot;
|
|
119
|
+
transform.localScale = startScale;
|
|
120
|
+
dispatch();
|
|
121
|
+
},
|
|
122
|
+
redoAction: () => {
|
|
123
|
+
transform.localPosition = finalPos;
|
|
124
|
+
transform.localRotation = finalRot;
|
|
125
|
+
transform.localScale = finalScale;
|
|
126
|
+
dispatch();
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppObject, AppObjectRepo, AppObjectUC } from "../../../AppObject";
|
|
2
|
+
export declare abstract class StickUC extends AppObjectUC {
|
|
3
|
+
static readonly type = "StickUC";
|
|
4
|
+
abstract doStick(): void;
|
|
5
|
+
static get(id: string, appObjects: AppObjectRepo): StickUC | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare function makeStickUC(appObject: AppObject): StickUC;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeStickUC = exports.StickUC = void 0;
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
|
+
const ValueObjects_1 = require("../../../ValueObjects");
|
|
6
|
+
const DispatchStateChangeUC_1 = require("../../Dispatcher/UC/DispatchStateChangeUC");
|
|
7
|
+
const Transform3D_1 = require("../../Transform3D/Entities/Transform3D");
|
|
8
|
+
const UndoRedoEntity_1 = require("../../UndoRedo/Entities/UndoRedoEntity");
|
|
9
|
+
const Stickable_1 = require("../Entities/Stickable");
|
|
10
|
+
class StickUC extends AppObject_1.AppObjectUC {
|
|
11
|
+
static get(id, appObjects) {
|
|
12
|
+
var _a;
|
|
13
|
+
return (_a = appObjects.get(id)) === null || _a === void 0 ? void 0 : _a.getComponent(StickUC.type);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.StickUC = StickUC;
|
|
17
|
+
StickUC.type = "StickUC";
|
|
18
|
+
function makeStickUC(appObject) {
|
|
19
|
+
return new StickUCImp(appObject);
|
|
20
|
+
}
|
|
21
|
+
exports.makeStickUC = makeStickUC;
|
|
22
|
+
class StickUCImp extends StickUC {
|
|
23
|
+
constructor(appObject) {
|
|
24
|
+
super(appObject, StickUC.type);
|
|
25
|
+
this.doStick = () => {
|
|
26
|
+
var _a;
|
|
27
|
+
const transform = this.transform3D;
|
|
28
|
+
const dispatch = this.dispatchStateChange;
|
|
29
|
+
if (!transform || !this.stickEntity || !dispatch) {
|
|
30
|
+
this.error("Missing Components");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!this.stickEntity.canBeStuck)
|
|
34
|
+
return;
|
|
35
|
+
const startPos = transform.localPosition;
|
|
36
|
+
const finalPos = this.stickEntity.stickPosition;
|
|
37
|
+
const startRot = transform.localRotation;
|
|
38
|
+
const finalRot = this.stickEntity.stickRotation;
|
|
39
|
+
const startScale = transform.localScale;
|
|
40
|
+
const finalScale = new ValueObjects_1.Vector3(this.stickEntity.stickScale, this.stickEntity.stickScale, this.stickEntity.stickScale);
|
|
41
|
+
this.stickEntity.doStick(dispatch);
|
|
42
|
+
(_a = this.undo) === null || _a === void 0 ? void 0 : _a.submitAction({
|
|
43
|
+
undoAction: () => {
|
|
44
|
+
transform.localPosition = startPos;
|
|
45
|
+
transform.localRotation = startRot;
|
|
46
|
+
transform.localScale = startScale;
|
|
47
|
+
dispatch();
|
|
48
|
+
},
|
|
49
|
+
redoAction: () => {
|
|
50
|
+
transform.localPosition = finalPos;
|
|
51
|
+
transform.localRotation = finalRot;
|
|
52
|
+
transform.localScale = finalScale;
|
|
53
|
+
dispatch();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
get stickEntity() {
|
|
59
|
+
return this.getCachedLocalComponent(Stickable_1.StickableEntity.type);
|
|
60
|
+
}
|
|
61
|
+
get transform3D() {
|
|
62
|
+
return this.getCachedLocalComponent(Transform3D_1.Transform3D.type);
|
|
63
|
+
}
|
|
64
|
+
get dispatchStateChange() {
|
|
65
|
+
var _a;
|
|
66
|
+
return (_a = this.getCachedSingleton(DispatchStateChangeUC_1.DispatchStateChangeUC.type)) === null || _a === void 0 ? void 0 : _a.doDispatch;
|
|
67
|
+
}
|
|
68
|
+
get undo() {
|
|
69
|
+
return this.getCachedSingleton(UndoRedoEntity_1.UndoRedoEntity.type);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AppObject, AppObjectRepo, AppObjectUC } from "../../../AppObject";
|
|
2
|
+
import { ParametricLine } from "../../../ValueObjects";
|
|
3
|
+
export declare abstract class TryPickStickTargetUC extends AppObjectUC {
|
|
4
|
+
static type: string;
|
|
5
|
+
abstract tryPick(ray: ParametricLine): boolean;
|
|
6
|
+
static get(id: string, appObjects: AppObjectRepo): TryPickStickTargetUC | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function makeTryPickStickTargetUC(appObject: AppObject): TryPickStickTargetUC;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeTryPickStickTargetUC = exports.TryPickStickTargetUC = void 0;
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
|
+
class TryPickStickTargetUC extends AppObject_1.AppObjectUC {
|
|
6
|
+
static get(id, appObjects) {
|
|
7
|
+
var _a;
|
|
8
|
+
return (_a = appObjects
|
|
9
|
+
.get(id)) === null || _a === void 0 ? void 0 : _a.getComponent(TryPickStickTargetUC.type);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.TryPickStickTargetUC = TryPickStickTargetUC;
|
|
13
|
+
TryPickStickTargetUC.type = "TryPickStickTargetUC";
|
|
14
|
+
function makeTryPickStickTargetUC(appObject) {
|
|
15
|
+
return new TryPickStickTargetUCImp(appObject);
|
|
16
|
+
}
|
|
17
|
+
exports.makeTryPickStickTargetUC = makeTryPickStickTargetUC;
|
|
18
|
+
class TryPickStickTargetUCImp extends TryPickStickTargetUC {
|
|
19
|
+
constructor(appObject) {
|
|
20
|
+
super(appObject, TryPickStickTargetUC.type);
|
|
21
|
+
this.tryPick = (pickRay) => {
|
|
22
|
+
this.warn("Picker needs to be injected");
|
|
23
|
+
return false;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AppObject, AppObjectRepo, AppObjectUC } from "../../../AppObject";
|
|
2
|
+
import { ParametricLine, Vector2 } from "../../../ValueObjects";
|
|
3
|
+
export declare abstract class TryStickAppObjectUC extends AppObjectUC {
|
|
4
|
+
static type: string;
|
|
5
|
+
abstract tryWithRay(ray: ParametricLine): void;
|
|
6
|
+
abstract tryWithPixel(pixel: Vector2): void;
|
|
7
|
+
abstract allow(): void;
|
|
8
|
+
static get(appObjects: AppObjectRepo): TryStickAppObjectUC | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function makeTryStickAppObjectUC(appObject: AppObject): TryStickAppObjectUC;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeTryStickAppObjectUC = exports.TryStickAppObjectUC = void 0;
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
|
+
const UC_1 = require("../../Babylon/UC");
|
|
6
|
+
const StickUC_1 = require("./StickUC");
|
|
7
|
+
class TryStickAppObjectUC extends AppObject_1.AppObjectUC {
|
|
8
|
+
static get(appObjects) {
|
|
9
|
+
return AppObject_1.getSingletonComponent(TryStickAppObjectUC.type, appObjects);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.TryStickAppObjectUC = TryStickAppObjectUC;
|
|
13
|
+
TryStickAppObjectUC.type = "TryStickAppObjectUC";
|
|
14
|
+
function makeTryStickAppObjectUC(appObject) {
|
|
15
|
+
return new TryStickAppObjectUCImp(appObject);
|
|
16
|
+
}
|
|
17
|
+
exports.makeTryStickAppObjectUC = makeTryStickAppObjectUC;
|
|
18
|
+
class TryStickAppObjectUCImp extends TryStickAppObjectUC {
|
|
19
|
+
constructor(appObject) {
|
|
20
|
+
super(appObject, TryStickAppObjectUC.type);
|
|
21
|
+
this.allow = () => {
|
|
22
|
+
return true;
|
|
23
|
+
};
|
|
24
|
+
this.tryWithPixel = (pixel) => {
|
|
25
|
+
var _a;
|
|
26
|
+
if (!this.allow())
|
|
27
|
+
return;
|
|
28
|
+
if (!this.pixelPick) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const appObjectID = (_a = this.pixelPick(pixel)) === null || _a === void 0 ? void 0 : _a.appObjectID;
|
|
32
|
+
if (!appObjectID) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
this.stickByID(appObjectID);
|
|
36
|
+
};
|
|
37
|
+
this.tryWithRay = (pickRay) => {
|
|
38
|
+
var _a;
|
|
39
|
+
if (!this.allow())
|
|
40
|
+
return;
|
|
41
|
+
if (!this.rayPick) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const appObjectID = (_a = this.rayPick(pickRay)) === null || _a === void 0 ? void 0 : _a.appObjectID;
|
|
45
|
+
if (!appObjectID) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.stickByID(appObjectID);
|
|
49
|
+
};
|
|
50
|
+
this.appObjects.registerSingleton(this);
|
|
51
|
+
}
|
|
52
|
+
get pixelPick() {
|
|
53
|
+
var _a;
|
|
54
|
+
return (_a = this.getCachedSingleton(UC_1.ScenePixelPickUC.type)) === null || _a === void 0 ? void 0 : _a.scenePixelPick;
|
|
55
|
+
}
|
|
56
|
+
get rayPick() {
|
|
57
|
+
var _a;
|
|
58
|
+
return (_a = this.getCachedSingleton(UC_1.SceneRayPickUC.type)) === null || _a === void 0 ? void 0 : _a.sceneRayPick;
|
|
59
|
+
}
|
|
60
|
+
stickByID(id) {
|
|
61
|
+
const appObj = this.appObjects.get(id);
|
|
62
|
+
if (!appObj) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (!appObj.hasComponent(StickUC_1.StickUC.type)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const stickUC = appObj.getComponent(StickUC_1.StickUC.type);
|
|
69
|
+
if (!stickUC) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
stickUC.doStick();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -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("./PanTransformWithStickUC"), exports);
|
|
14
|
+
__exportStar(require("./StickUC"), exports);
|
|
15
|
+
__exportStar(require("./TryPickStickTarget"), exports);
|
|
16
|
+
__exportStar(require("./TryStickAppObjectUC"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./Adapters"), exports);
|
|
14
|
+
__exportStar(require("./Controllers"), exports);
|
|
15
|
+
__exportStar(require("./Entities"), exports);
|
|
16
|
+
__exportStar(require("./Factories"), exports);
|
|
17
|
+
__exportStar(require("./Mocks"), exports);
|
|
18
|
+
__exportStar(require("./PMs"), exports);
|
|
19
|
+
__exportStar(require("./UCs"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./setupStylus";
|
|
@@ -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("./setupStylus"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupStylus = void 0;
|
|
4
|
+
const Transform3D_1 = require("../../Transform3D");
|
|
5
|
+
const Entity_1 = require("../Entity");
|
|
6
|
+
const PMs_1 = require("../PMs");
|
|
7
|
+
const UCs_1 = require("../UCs");
|
|
8
|
+
function setupStylus(appObjects) {
|
|
9
|
+
const ao = appObjects.getOrCreate("Stylus");
|
|
10
|
+
// Entities
|
|
11
|
+
Entity_1.makeStylusEntity(ao);
|
|
12
|
+
// UCs
|
|
13
|
+
UCs_1.makeEmulateStylusUC(ao);
|
|
14
|
+
// PMs
|
|
15
|
+
PMs_1.makeStylusColorLengthPM(ao);
|
|
16
|
+
PMs_1.makeStylusIsInUsePM(ao);
|
|
17
|
+
Transform3D_1.makeTransform3DPM(ao);
|
|
18
|
+
}
|
|
19
|
+
exports.setupStylus = setupStylus;
|
|
@@ -12,6 +12,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./Adapters"), exports);
|
|
14
14
|
__exportStar(require("./Entity"), exports);
|
|
15
|
+
__exportStar(require("./Factories"), exports);
|
|
15
16
|
__exportStar(require("./Mocks"), exports);
|
|
16
17
|
__exportStar(require("./PMs"), exports);
|
|
17
18
|
__exportStar(require("./UCs"), exports);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AppObject, AppObjectRepo, AppObjectUC } from "../../../AppObject";
|
|
2
|
-
import { ParametricLine, Vector2 } from "../../../ValueObjects";
|
|
2
|
+
import { ParametricLine, ParametricPlane, Vector2, Vector3 } from "../../../ValueObjects";
|
|
3
|
+
import { UndoRedoEntity } from "../../UndoRedo";
|
|
4
|
+
import { Transform3D } from "../Entities";
|
|
3
5
|
export declare abstract class PanTransformUC extends AppObjectUC {
|
|
4
6
|
static readonly type = "PanTransformUC";
|
|
5
7
|
abstract minX?: number;
|
|
@@ -18,3 +20,28 @@ export declare abstract class PanTransformUC extends AppObjectUC {
|
|
|
18
20
|
static get(id: string, appObjects: AppObjectRepo): PanTransformUC | undefined;
|
|
19
21
|
}
|
|
20
22
|
export declare function makePanTransformUC(appObject: AppObject): PanTransformUC;
|
|
23
|
+
export declare class PanTransformUCImp extends PanTransformUC {
|
|
24
|
+
minX?: number | undefined;
|
|
25
|
+
maxX?: number | undefined;
|
|
26
|
+
minY?: number | undefined;
|
|
27
|
+
maxY?: number | undefined;
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
protected panPlane: ParametricPlane;
|
|
30
|
+
dispatchStateChangeOnComplete: boolean;
|
|
31
|
+
submitUndoOnComplete: boolean;
|
|
32
|
+
protected pickOffset: Vector3;
|
|
33
|
+
protected initialPosition: Vector3;
|
|
34
|
+
protected hasBeenInitialized: boolean;
|
|
35
|
+
protected get transformNode(): Transform3D | undefined;
|
|
36
|
+
protected get undoRedo(): UndoRedoEntity | undefined;
|
|
37
|
+
protected get dispatchStateChange(): (() => void) | undefined;
|
|
38
|
+
initializePixel: (initialPixelPos: Vector2) => void;
|
|
39
|
+
updatePixel: (pixelPosition: Vector2) => void;
|
|
40
|
+
initializeRay: (ray: ParametricLine) => void;
|
|
41
|
+
updateRay: (ray: ParametricLine) => void;
|
|
42
|
+
protected enforceBoundaries(wPos: Vector3): Vector3;
|
|
43
|
+
finish: () => void;
|
|
44
|
+
protected submitDispatchAndUndo(): void;
|
|
45
|
+
cancelPan: () => void;
|
|
46
|
+
constructor(appObject: AppObject);
|
|
47
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makePanTransformUC = exports.PanTransformUC = void 0;
|
|
3
|
+
exports.PanTransformUCImp = exports.makePanTransformUC = exports.PanTransformUC = void 0;
|
|
4
4
|
const AppObject_1 = require("../../../AppObject");
|
|
5
5
|
const ValueObjects_1 = require("../../../ValueObjects");
|
|
6
6
|
const Babylon_1 = require("../../Babylon");
|
|
7
7
|
const Dispatcher_1 = require("../../Dispatcher");
|
|
8
8
|
const UndoRedo_1 = require("../../UndoRedo");
|
|
9
9
|
const Entities_1 = require("../Entities");
|
|
10
|
-
const MoveTransformUndoRedo_1 = require("./MoveTransformUndoRedo");
|
|
11
10
|
class PanTransformUC extends AppObject_1.AppObjectUC {
|
|
12
11
|
static get(id, appObjects) {
|
|
13
12
|
var _a;
|
|
@@ -49,7 +48,7 @@ class PanTransformUCImp extends PanTransformUC {
|
|
|
49
48
|
const rootPos = this.transformNode.worldPosition;
|
|
50
49
|
this.pickOffset = ValueObjects_1.Vector3.Subtract(rootPos, pick);
|
|
51
50
|
this.hasBeenInitialized = true;
|
|
52
|
-
this.initialPosition = this.transformNode.
|
|
51
|
+
this.initialPosition = this.transformNode.localPosition;
|
|
53
52
|
};
|
|
54
53
|
this.updateRay = (ray) => {
|
|
55
54
|
var _a;
|
|
@@ -60,44 +59,17 @@ class PanTransformUCImp extends PanTransformUC {
|
|
|
60
59
|
if (!this.enabled)
|
|
61
60
|
return;
|
|
62
61
|
const pick = (_a = this.panPlane.intersectLine(ray)) !== null && _a !== void 0 ? _a : ValueObjects_1.Vector3.Zero();
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
if (this.maxX !== undefined && wPos.x > this.maxX) {
|
|
68
|
-
wPos = new ValueObjects_1.Vector3(this.maxX, wPos.y, wPos.z);
|
|
69
|
-
}
|
|
70
|
-
if (this.minY !== undefined && wPos.y < this.minY) {
|
|
71
|
-
wPos = new ValueObjects_1.Vector3(wPos.x, this.minY, wPos.z);
|
|
72
|
-
}
|
|
73
|
-
if (this.maxY !== undefined && wPos.y > this.maxY) {
|
|
74
|
-
wPos = new ValueObjects_1.Vector3(wPos.x, this.maxY, wPos.z);
|
|
75
|
-
}
|
|
76
|
-
this.transformNode.worldPosition = wPos;
|
|
62
|
+
const wPos = ValueObjects_1.Vector3.Add(pick, this.pickOffset);
|
|
63
|
+
const clampedPos = this.enforceBoundaries(wPos);
|
|
64
|
+
this.transformNode.worldPosition = clampedPos;
|
|
77
65
|
};
|
|
78
66
|
this.finish = () => {
|
|
79
|
-
var _a, _b;
|
|
80
|
-
if (!this.transformNode)
|
|
81
|
-
return;
|
|
82
67
|
if (!this.hasBeenInitialized)
|
|
83
68
|
return;
|
|
84
69
|
if (!this.enabled)
|
|
85
70
|
return;
|
|
86
71
|
this.hasBeenInitialized = false;
|
|
87
|
-
|
|
88
|
-
return;
|
|
89
|
-
if (this.dispatchStateChangeOnComplete) {
|
|
90
|
-
Dispatcher_1.dispatchStateChange(this.appObjects);
|
|
91
|
-
}
|
|
92
|
-
if (this.submitUndoOnComplete) {
|
|
93
|
-
const undoDTO = {
|
|
94
|
-
endPosition: this.transformNode.localPosition,
|
|
95
|
-
endRotation: this.transformNode.localRotation,
|
|
96
|
-
startPosition: this.initialPosition,
|
|
97
|
-
startRotation: this.transformNode.localRotation,
|
|
98
|
-
};
|
|
99
|
-
(_b = this.undoRedo) === null || _b === void 0 ? void 0 : _b.submitAction(new MoveTransformUndoRedo_1.MoveTransformUndoRedo(undoDTO, this.transformNode, this.appObjects));
|
|
100
|
-
}
|
|
72
|
+
this.submitDispatchAndUndo();
|
|
101
73
|
};
|
|
102
74
|
this.cancelPan = () => {
|
|
103
75
|
this.hasBeenInitialized = false;
|
|
@@ -109,4 +81,50 @@ class PanTransformUCImp extends PanTransformUC {
|
|
|
109
81
|
get undoRedo() {
|
|
110
82
|
return this.getCachedSingleton(UndoRedo_1.UndoRedoEntity.type);
|
|
111
83
|
}
|
|
84
|
+
get dispatchStateChange() {
|
|
85
|
+
var _a;
|
|
86
|
+
return (_a = this.getCachedSingleton(Dispatcher_1.DispatchStateChangeUC.type)) === null || _a === void 0 ? void 0 : _a.doDispatch;
|
|
87
|
+
}
|
|
88
|
+
enforceBoundaries(wPos) {
|
|
89
|
+
let pos = wPos;
|
|
90
|
+
if (this.minX !== undefined && pos.x < this.minX) {
|
|
91
|
+
pos = new ValueObjects_1.Vector3(this.minX, pos.y, pos.z);
|
|
92
|
+
}
|
|
93
|
+
if (this.maxX !== undefined && pos.x > this.maxX) {
|
|
94
|
+
pos = new ValueObjects_1.Vector3(this.maxX, pos.y, pos.z);
|
|
95
|
+
}
|
|
96
|
+
if (this.minY !== undefined && pos.y < this.minY) {
|
|
97
|
+
pos = new ValueObjects_1.Vector3(pos.x, this.minY, pos.z);
|
|
98
|
+
}
|
|
99
|
+
if (this.maxY !== undefined && pos.y > this.maxY) {
|
|
100
|
+
pos = new ValueObjects_1.Vector3(pos.x, this.maxY, pos.z);
|
|
101
|
+
}
|
|
102
|
+
return pos;
|
|
103
|
+
}
|
|
104
|
+
submitDispatchAndUndo() {
|
|
105
|
+
var _a;
|
|
106
|
+
const dispatch = this.dispatchStateChange;
|
|
107
|
+
const transform = this.transformNode;
|
|
108
|
+
if (!transform || !dispatch)
|
|
109
|
+
return;
|
|
110
|
+
if (ValueObjects_1.Vector3.Equal(this.initialPosition, transform.localPosition))
|
|
111
|
+
return;
|
|
112
|
+
if (this.dispatchStateChangeOnComplete) {
|
|
113
|
+
dispatch();
|
|
114
|
+
}
|
|
115
|
+
if (this.submitUndoOnComplete) {
|
|
116
|
+
const redoPos = transform.localPosition;
|
|
117
|
+
(_a = this.undoRedo) === null || _a === void 0 ? void 0 : _a.submitAction({
|
|
118
|
+
undoAction: () => {
|
|
119
|
+
transform.localPosition = this.initialPosition;
|
|
120
|
+
dispatch();
|
|
121
|
+
},
|
|
122
|
+
redoAction: () => {
|
|
123
|
+
transform.localPosition = redoPos;
|
|
124
|
+
dispatch();
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
112
129
|
}
|
|
130
|
+
exports.PanTransformUCImp = PanTransformUCImp;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AppObject, AppObjectUC } from "../../../AppObject";
|
|
2
2
|
import { ParametricLine, Vector2 } from "../../../ValueObjects";
|
|
3
|
+
import { SceneRayPickUC } from "../../Babylon";
|
|
3
4
|
import { PanTransformUC } from "./PanTransformUC";
|
|
4
5
|
export declare abstract class TryPanTransformUC extends AppObjectUC {
|
|
5
6
|
static readonly type = "TryPanTransformUC";
|
|
@@ -14,8 +15,8 @@ export declare abstract class TryPanTransformUC extends AppObjectUC {
|
|
|
14
15
|
export declare function makeTryPanTransformUC(appObject: AppObject): TryPanTransformUC;
|
|
15
16
|
export declare class TryPanTransformUCImp extends TryPanTransformUC {
|
|
16
17
|
protected panUC?: PanTransformUC;
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
protected get pixelToRay(): ((pixelPos: Vector2) => ParametricLine) | undefined;
|
|
19
|
+
protected get rayPickUC(): SceneRayPickUC | undefined;
|
|
19
20
|
allow: () => boolean;
|
|
20
21
|
tryWithPixel: (pixel: Vector2) => boolean;
|
|
21
22
|
moveWithPixel: (pixel: Vector2) => void;
|
|
@@ -17,6 +17,5 @@ __exportStar(require("./PanTransformUC"), exports);
|
|
|
17
17
|
__exportStar(require("./PinchTransform"), exports);
|
|
18
18
|
__exportStar(require("./RayPanScaleTransform"), exports);
|
|
19
19
|
__exportStar(require("./ScaleTransform"), exports);
|
|
20
|
-
__exportStar(require("./StickTransformUC"), exports);
|
|
21
20
|
__exportStar(require("./StylusMoveTransformUC"), exports);
|
|
22
21
|
__exportStar(require("./TryPanTransformUC"), exports);
|