@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,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DoubleClickToStickMC = void 0;
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
|
+
const ValueObjects_1 = require("../../../ValueObjects");
|
|
6
|
+
const MouseInput_1 = require("../../MouseInput");
|
|
7
|
+
const TryStickAppObjectUC_1 = require("../UCs/TryStickAppObjectUC");
|
|
8
|
+
class DoubleClickToStickMC extends AppObject_1.AppObjectController {
|
|
9
|
+
constructor(appObject) {
|
|
10
|
+
var _a;
|
|
11
|
+
super(appObject, DoubleClickToStickMC.type);
|
|
12
|
+
this.maxClickTimeMS = 300;
|
|
13
|
+
this.maxClickDistancePx = 5;
|
|
14
|
+
this.initialClickPos = ValueObjects_1.Vector2.Zero();
|
|
15
|
+
this.initialClickTime = 0;
|
|
16
|
+
this.clickCount = 0;
|
|
17
|
+
this.onClick = (e) => {
|
|
18
|
+
if (!this.tryStickSceneMesh) {
|
|
19
|
+
this.error("Missing Component");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (e.button !== 0) {
|
|
23
|
+
this.cancelDoubleClick();
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this.clickCount = 1 + this.clickCount;
|
|
27
|
+
if (this.clickCount === 1) {
|
|
28
|
+
this.initialClickPos = e.position;
|
|
29
|
+
this.initialClickTime = Date.now();
|
|
30
|
+
}
|
|
31
|
+
else if (this.clickCount === 2) {
|
|
32
|
+
const movement = ValueObjects_1.Vector2.Subtract(this.initialClickPos, e.position).magnitued;
|
|
33
|
+
const passedTime = Date.now() - this.initialClickTime;
|
|
34
|
+
if (passedTime <= this.maxClickTimeMS &&
|
|
35
|
+
movement <= this.maxClickDistancePx) {
|
|
36
|
+
this.tryStickSceneMesh(e.position);
|
|
37
|
+
}
|
|
38
|
+
this.cancelDoubleClick();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
this.cancelDoubleClick = () => {
|
|
42
|
+
this.initialClickPos = ValueObjects_1.Vector2.Zero();
|
|
43
|
+
this.initialClickTime = 0;
|
|
44
|
+
this.clickCount = 0;
|
|
45
|
+
};
|
|
46
|
+
(_a = this.mouseInput) === null || _a === void 0 ? void 0 : _a.registerController(this);
|
|
47
|
+
}
|
|
48
|
+
get mouseInput() {
|
|
49
|
+
return this.getCachedSingleton(MouseInput_1.MouseInputEntity.type);
|
|
50
|
+
}
|
|
51
|
+
get tryStickSceneMesh() {
|
|
52
|
+
var _a;
|
|
53
|
+
return (_a = this.getCachedSingleton(TryStickAppObjectUC_1.TryStickAppObjectUC.type)) === null || _a === void 0 ? void 0 : _a.tryWithPixel;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.DoubleClickToStickMC = DoubleClickToStickMC;
|
|
57
|
+
DoubleClickToStickMC.type = "DoubleClickToStickMC";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AppObject, AppObjectController } from "../../../AppObject";
|
|
2
|
+
import { TouchController, TouchInputEvent } from "../../TouchController";
|
|
3
|
+
export declare class DoubleTapToStickTC extends AppObjectController implements TouchController {
|
|
4
|
+
static type: string;
|
|
5
|
+
readonly tapTimeMS = 300;
|
|
6
|
+
readonly maxTapDistancePx = 30;
|
|
7
|
+
private initialTouchPos;
|
|
8
|
+
private initialTouchTime;
|
|
9
|
+
private tapCount;
|
|
10
|
+
private get touchInput();
|
|
11
|
+
private get tryStickSceneMesh();
|
|
12
|
+
onTap: (e: TouchInputEvent) => void;
|
|
13
|
+
private cancelDoubleTap;
|
|
14
|
+
constructor(appObject: AppObject);
|
|
15
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DoubleTapToStickTC = void 0;
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
|
+
const ValueObjects_1 = require("../../../ValueObjects");
|
|
6
|
+
const TouchController_1 = require("../../TouchController");
|
|
7
|
+
const TryStickAppObjectUC_1 = require("../UCs/TryStickAppObjectUC");
|
|
8
|
+
class DoubleTapToStickTC extends AppObject_1.AppObjectController {
|
|
9
|
+
constructor(appObject) {
|
|
10
|
+
var _a;
|
|
11
|
+
super(appObject, DoubleTapToStickTC.type);
|
|
12
|
+
this.tapTimeMS = 300;
|
|
13
|
+
this.maxTapDistancePx = 30;
|
|
14
|
+
this.initialTouchPos = ValueObjects_1.Vector2.Zero();
|
|
15
|
+
this.initialTouchTime = 0;
|
|
16
|
+
this.tapCount = 0;
|
|
17
|
+
this.onTap = (e) => {
|
|
18
|
+
if (!this.tryStickSceneMesh) {
|
|
19
|
+
this.error("Missing Component");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
this.tapCount = 1 + this.tapCount;
|
|
23
|
+
if (this.tapCount === 1) {
|
|
24
|
+
this.initialTouchPos = e.touchCenter;
|
|
25
|
+
this.initialTouchTime = Date.now();
|
|
26
|
+
}
|
|
27
|
+
else if (this.tapCount === 2) {
|
|
28
|
+
const movement = ValueObjects_1.Vector2.Subtract(this.initialTouchPos, e.touchCenter).magnitued;
|
|
29
|
+
const passedTime = Date.now() - this.initialTouchTime;
|
|
30
|
+
if (passedTime <= this.tapTimeMS && movement <= this.maxTapDistancePx) {
|
|
31
|
+
this.tryStickSceneMesh(e.touchCenter);
|
|
32
|
+
}
|
|
33
|
+
this.cancelDoubleTap();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
this.cancelDoubleTap = () => {
|
|
37
|
+
this.initialTouchPos = ValueObjects_1.Vector2.Zero();
|
|
38
|
+
this.initialTouchTime = 0;
|
|
39
|
+
this.tapCount = 0;
|
|
40
|
+
};
|
|
41
|
+
(_a = this.touchInput) === null || _a === void 0 ? void 0 : _a.registerController(this);
|
|
42
|
+
}
|
|
43
|
+
get touchInput() {
|
|
44
|
+
return this.getCachedSingleton(TouchController_1.TouchInputEntity.type);
|
|
45
|
+
}
|
|
46
|
+
get tryStickSceneMesh() {
|
|
47
|
+
var _a;
|
|
48
|
+
return (_a = this.getCachedSingleton(TryStickAppObjectUC_1.TryStickAppObjectUC.type)) === null || _a === void 0 ? void 0 : _a.tryWithPixel;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.DoubleTapToStickTC = DoubleTapToStickTC;
|
|
52
|
+
DoubleTapToStickTC.type = "DoubleTapToStickTC";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clickStick = void 0;
|
|
4
|
+
const StickUC_1 = require("../UCs/StickUC");
|
|
5
|
+
function clickStick(id, appObjects) {
|
|
6
|
+
const uc = StickUC_1.StickUC.get(id, appObjects);
|
|
7
|
+
if (!uc) {
|
|
8
|
+
appObjects.submitError("clickStick", "Unable to find StickUC");
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
uc.doStick();
|
|
12
|
+
}
|
|
13
|
+
exports.clickStick = clickStick;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./DoubleClickToStickMC"), exports);
|
|
14
|
+
__exportStar(require("./DoubleTapToStickTC"), exports);
|
|
15
|
+
__exportStar(require("./clickStick"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AppObject, AppObjectEntity, AppObjectRepo } from "../../../AppObject";
|
|
2
|
+
import { EaseFn } from "../../../Types";
|
|
3
|
+
import { Quaternion, Vector3 } from "../../../ValueObjects";
|
|
4
|
+
export declare abstract class StickableEntity extends AppObjectEntity {
|
|
5
|
+
static readonly type = "StickableEntity";
|
|
6
|
+
abstract get canBeStuck(): boolean;
|
|
7
|
+
abstract get stickPosition(): Vector3;
|
|
8
|
+
abstract set stickPosition(val: Vector3);
|
|
9
|
+
abstract get stickRotation(): Quaternion;
|
|
10
|
+
abstract set stickRotation(val: Quaternion);
|
|
11
|
+
abstract get stickScale(): number;
|
|
12
|
+
abstract set stickScale(val: number);
|
|
13
|
+
abstract get showStickTarget(): boolean;
|
|
14
|
+
abstract set showStickTarget(showStickTarget: boolean);
|
|
15
|
+
abstract get highlightTarget(): boolean;
|
|
16
|
+
abstract set highlightTarget(highlightTarget: boolean);
|
|
17
|
+
abstract stickDurationMS: number;
|
|
18
|
+
abstract easeFn: EaseFn;
|
|
19
|
+
abstract doStick(onCompleteCallback?: () => void): void;
|
|
20
|
+
static get(id: string, appObjects: AppObjectRepo): StickableEntity | undefined;
|
|
21
|
+
}
|
|
22
|
+
export declare function makeStickableEntity(appObject: AppObject): StickableEntity;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeStickableEntity = exports.StickableEntity = void 0;
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
|
+
const Entities_1 = require("../../../Entities");
|
|
6
|
+
const Utilities_1 = require("../../../Utilities");
|
|
7
|
+
const ValueObjects_1 = require("../../../ValueObjects");
|
|
8
|
+
const Transform3D_1 = require("../../Transform3D");
|
|
9
|
+
class StickableEntity extends AppObject_1.AppObjectEntity {
|
|
10
|
+
static get(id, appObjects) {
|
|
11
|
+
var _a;
|
|
12
|
+
return (_a = appObjects
|
|
13
|
+
.get(id)) === null || _a === void 0 ? void 0 : _a.getComponent(StickableEntity.type);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.StickableEntity = StickableEntity;
|
|
17
|
+
StickableEntity.type = "StickableEntity";
|
|
18
|
+
function makeStickableEntity(appObject) {
|
|
19
|
+
return new StickableEntityImp(appObject);
|
|
20
|
+
}
|
|
21
|
+
exports.makeStickableEntity = makeStickableEntity;
|
|
22
|
+
class StickableEntityImp extends StickableEntity {
|
|
23
|
+
constructor(appObject) {
|
|
24
|
+
super(appObject, StickableEntity.type);
|
|
25
|
+
this.stickDurationMS = 500;
|
|
26
|
+
this.easeFn = Utilities_1.expoOut;
|
|
27
|
+
this.memoizedCanBeStuck = new Entities_1.MemoizedBoolean(false, this.notifyOnChange);
|
|
28
|
+
this.memoizedStickPosition = new Entities_1.MemoizedVector3(ValueObjects_1.Vector3.Zero(), this.notifyOnChange);
|
|
29
|
+
this.memoizedStickRotation = new Entities_1.MemoizedQuaternion(ValueObjects_1.Quaternion.Identity(), this.notifyOnChange);
|
|
30
|
+
this.memoizedStickScale = new Entities_1.MemoizedNumber(1, this.notifyOnChange);
|
|
31
|
+
this.memoizedShowStickTarget = new Entities_1.MemoizedBoolean(false, this.notifyOnChange);
|
|
32
|
+
this.memoizedHighlightTarget = new Entities_1.MemoizedBoolean(false, this.notifyOnChange);
|
|
33
|
+
this.checkIfStickable = () => {
|
|
34
|
+
if (!ValueObjects_1.Vector3.Equal(this.transform.localPosition, this.memoizedStickPosition.val)) {
|
|
35
|
+
this.memoizedCanBeStuck.val = true;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (this.transform.localScale.x !== this.memoizedStickScale.val) {
|
|
39
|
+
this.memoizedCanBeStuck.val = true;
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (!ValueObjects_1.Quaternion.Close(this.transform.localRotation, this.memoizedStickRotation.val)) {
|
|
43
|
+
this.memoizedCanBeStuck.val = true;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.memoizedCanBeStuck.val = false;
|
|
47
|
+
};
|
|
48
|
+
this.transform = Transform3D_1.Transform3D.addIfMissing(appObject);
|
|
49
|
+
this.transform.addChangeObserver(this.checkIfStickable);
|
|
50
|
+
this.checkIfStickable();
|
|
51
|
+
}
|
|
52
|
+
doStick(onCompleteCallback) {
|
|
53
|
+
if (!this.canBeStuck)
|
|
54
|
+
return;
|
|
55
|
+
const lerpData = {
|
|
56
|
+
durationMS: this.stickDurationMS,
|
|
57
|
+
ease: this.easeFn,
|
|
58
|
+
desiredPosition: this.stickPosition,
|
|
59
|
+
desiredRotation: this.stickRotation,
|
|
60
|
+
desiredScale: new ValueObjects_1.Vector3(this.stickScale, this.stickScale, this.stickScale),
|
|
61
|
+
onCompletedCallback: onCompleteCallback
|
|
62
|
+
};
|
|
63
|
+
this.transform.lerp(lerpData);
|
|
64
|
+
}
|
|
65
|
+
get canBeStuck() {
|
|
66
|
+
return this.memoizedCanBeStuck.val;
|
|
67
|
+
}
|
|
68
|
+
get stickPosition() {
|
|
69
|
+
return this.memoizedStickPosition.val;
|
|
70
|
+
}
|
|
71
|
+
set stickPosition(val) {
|
|
72
|
+
this.memoizedStickPosition.val = val;
|
|
73
|
+
this.checkIfStickable();
|
|
74
|
+
}
|
|
75
|
+
get stickRotation() {
|
|
76
|
+
return this.memoizedStickRotation.val;
|
|
77
|
+
}
|
|
78
|
+
set stickRotation(val) {
|
|
79
|
+
this.memoizedStickRotation.val = val;
|
|
80
|
+
this.checkIfStickable();
|
|
81
|
+
}
|
|
82
|
+
get stickScale() {
|
|
83
|
+
return this.memoizedStickScale.val;
|
|
84
|
+
}
|
|
85
|
+
set stickScale(val) {
|
|
86
|
+
this.memoizedStickScale.val = val;
|
|
87
|
+
this.checkIfStickable();
|
|
88
|
+
}
|
|
89
|
+
get showStickTarget() {
|
|
90
|
+
return this.memoizedShowStickTarget.val;
|
|
91
|
+
}
|
|
92
|
+
set showStickTarget(showStickTarget) {
|
|
93
|
+
this.memoizedShowStickTarget.val = showStickTarget;
|
|
94
|
+
}
|
|
95
|
+
get highlightTarget() {
|
|
96
|
+
return this.memoizedHighlightTarget.val;
|
|
97
|
+
}
|
|
98
|
+
set highlightTarget(highlightTarget) {
|
|
99
|
+
this.memoizedHighlightTarget.val = highlightTarget;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Stickable";
|
|
@@ -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("./Stickable"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./setupStick";
|
|
@@ -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("./setupStick"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupStick = void 0;
|
|
4
|
+
const DoubleClickToStickMC_1 = require("../Controllers/DoubleClickToStickMC");
|
|
5
|
+
const DoubleTapToStickTC_1 = require("../Controllers/DoubleTapToStickTC");
|
|
6
|
+
const TryStickAppObjectUC_1 = require("../UCs/TryStickAppObjectUC");
|
|
7
|
+
function setupStick(appObjects) {
|
|
8
|
+
const ao = appObjects.getOrCreate("Stick");
|
|
9
|
+
// UCs
|
|
10
|
+
TryStickAppObjectUC_1.makeTryStickAppObjectUC(ao);
|
|
11
|
+
// Controllers
|
|
12
|
+
new DoubleClickToStickMC_1.DoubleClickToStickMC(ao);
|
|
13
|
+
new DoubleTapToStickTC_1.DoubleTapToStickTC(ao);
|
|
14
|
+
}
|
|
15
|
+
exports.setupStick = setupStick;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { AppObject } from "../../../AppObject";
|
|
3
|
+
import { StickTargetPM } from "../PMs/StickTargetPM";
|
|
4
|
+
export declare class StickTargetPmMock extends StickTargetPM {
|
|
5
|
+
vmsAreEqual: jest.Mock<any, any>;
|
|
6
|
+
constructor(appObject: AppObject);
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StickTargetPmMock = void 0;
|
|
4
|
+
const StickTargetPM_1 = require("../PMs/StickTargetPM");
|
|
5
|
+
class StickTargetPmMock extends StickTargetPM_1.StickTargetPM {
|
|
6
|
+
constructor(appObject) {
|
|
7
|
+
super(appObject, StickTargetPM_1.StickTargetPM.type);
|
|
8
|
+
this.vmsAreEqual = jest.fn();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.StickTargetPmMock = StickTargetPmMock;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StickUCMock = void 0;
|
|
4
|
+
const StickUC_1 = require("../UCs/StickUC");
|
|
5
|
+
class StickUCMock extends StickUC_1.StickUC {
|
|
6
|
+
constructor(appObject) {
|
|
7
|
+
super(appObject, StickUC_1.StickUC.type);
|
|
8
|
+
this.doStick = jest.fn();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.StickUCMock = StickUCMock;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { AppObject, AppObjectRepo } from "../../../AppObject";
|
|
3
|
+
import { TryStickAppObjectUC } from "../UCs/TryStickAppObjectUC";
|
|
4
|
+
export declare class TryStickAppObjectUCMock extends TryStickAppObjectUC {
|
|
5
|
+
allow: jest.Mock<any, any>;
|
|
6
|
+
tryWithRay: jest.Mock<any, any>;
|
|
7
|
+
tryWithPixel: jest.Mock<any, any>;
|
|
8
|
+
constructor(appObject: AppObject);
|
|
9
|
+
}
|
|
10
|
+
export declare function makeTryStickAppObjectUCMock(appObjects: AppObjectRepo): TryStickAppObjectUCMock;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeTryStickAppObjectUCMock = exports.TryStickAppObjectUCMock = void 0;
|
|
4
|
+
const TryStickAppObjectUC_1 = require("../UCs/TryStickAppObjectUC");
|
|
5
|
+
class TryStickAppObjectUCMock extends TryStickAppObjectUC_1.TryStickAppObjectUC {
|
|
6
|
+
constructor(appObject) {
|
|
7
|
+
super(appObject, TryStickAppObjectUC_1.TryStickAppObjectUC.type);
|
|
8
|
+
this.allow = jest.fn();
|
|
9
|
+
this.tryWithRay = jest.fn();
|
|
10
|
+
this.tryWithPixel = jest.fn();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.TryStickAppObjectUCMock = TryStickAppObjectUCMock;
|
|
14
|
+
function makeTryStickAppObjectUCMock(appObjects) {
|
|
15
|
+
return new TryStickAppObjectUCMock(appObjects.getOrCreate("TryStickAppObjectUCMock"));
|
|
16
|
+
}
|
|
17
|
+
exports.makeTryStickAppObjectUCMock = makeTryStickAppObjectUCMock;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./"), exports);
|
|
14
|
+
__exportStar(require("./StickUCMock"), exports);
|
|
15
|
+
__exportStar(require("./TryStickAppObjectUCMock"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AppObject, AppObjectPM, AppObjectRepo } from "../../../AppObject";
|
|
2
|
+
export interface StickTargetVM {
|
|
3
|
+
showStickTarget: boolean;
|
|
4
|
+
highlightTarget: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare abstract class StickTargetPM extends AppObjectPM<StickTargetVM> {
|
|
7
|
+
static readonly type = "StickTargetPM";
|
|
8
|
+
static get(id: string, appObjects: AppObjectRepo): StickTargetPM | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function makeStickTargetPM(appObject: AppObject): StickTargetPM;
|
|
11
|
+
export declare const defaultStickTargetVM: StickTargetVM;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultStickTargetVM = exports.makeStickTargetPM = exports.StickTargetPM = void 0;
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
|
+
const Stickable_1 = require("../Entities/Stickable");
|
|
6
|
+
class StickTargetPM extends AppObject_1.AppObjectPM {
|
|
7
|
+
static get(id, appObjects) {
|
|
8
|
+
var _a;
|
|
9
|
+
return (_a = appObjects.get(id)) === null || _a === void 0 ? void 0 : _a.getComponent(StickTargetPM.type);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.StickTargetPM = StickTargetPM;
|
|
13
|
+
StickTargetPM.type = "StickTargetPM";
|
|
14
|
+
function makeStickTargetPM(appObject) {
|
|
15
|
+
return new StickTargetPMImp(appObject);
|
|
16
|
+
}
|
|
17
|
+
exports.makeStickTargetPM = makeStickTargetPM;
|
|
18
|
+
class StickTargetPMImp extends StickTargetPM {
|
|
19
|
+
constructor(appObject) {
|
|
20
|
+
var _a;
|
|
21
|
+
super(appObject, StickTargetPM.type);
|
|
22
|
+
this.onEntityChange = () => {
|
|
23
|
+
if (!this.entity)
|
|
24
|
+
return;
|
|
25
|
+
const showStickTarget = this.entity.showStickTarget;
|
|
26
|
+
const highlightTarget = this.entity.highlightTarget;
|
|
27
|
+
const vm = {
|
|
28
|
+
showStickTarget,
|
|
29
|
+
highlightTarget,
|
|
30
|
+
};
|
|
31
|
+
this.doUpdateView(vm);
|
|
32
|
+
};
|
|
33
|
+
(_a = this.entity) === null || _a === void 0 ? void 0 : _a.addChangeObserver(this.onEntityChange);
|
|
34
|
+
this.onEntityChange();
|
|
35
|
+
}
|
|
36
|
+
get entity() {
|
|
37
|
+
return this.getCachedLocalComponent(Stickable_1.StickableEntity.type);
|
|
38
|
+
}
|
|
39
|
+
vmsAreEqual(a, b) {
|
|
40
|
+
if (a.highlightTarget !== b.highlightTarget)
|
|
41
|
+
return false;
|
|
42
|
+
if (a.showStickTarget !== b.showStickTarget)
|
|
43
|
+
return false;
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.defaultStickTargetVM = {
|
|
48
|
+
showStickTarget: false,
|
|
49
|
+
highlightTarget: false,
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StickTargetPM";
|
|
@@ -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("./StickTargetPM"), exports);
|