@vived/app 4.37.1 → 4.39.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/Callouts/UC/CreateCalloutUC.js +1 -1
- package/lib/Components/Hideable/Entities/Hideable.d.ts +1 -0
- package/lib/Components/Hideable/Entities/Hideable.js +1 -0
- package/lib/Components/Hideable/UCs/SerializeHideableObjects.js +1 -1
- package/lib/Components/Landmarks/Factories/setupLandmarks.js +8 -1
- package/lib/Components/Selection/UC/SelectAppObjectUC.js +11 -0
- package/lib/Components/Stylus/Entity/StylusEntity.d.ts +1 -0
- package/lib/Components/Stylus/Entity/StylusEntity.js +8 -0
- package/package.json +1 -1
- package/lib/Utilities/LerpNumberX.d.ts +0 -56
- package/lib/Utilities/LerpNumberX.js +0 -85
|
@@ -47,7 +47,7 @@ class CreateCalloutUCImp extends CreateCalloutUC {
|
|
|
47
47
|
callout.labelTransform.worldPosition = ValueObjects_1.Vector3.Add(labelBump, pickHit);
|
|
48
48
|
callout.labelTransform.worldRotation = ValueObjects_1.Quaternion.FromYawPitchRoll(ValueObjects_1.Angle.FromDegrees(180), ValueObjects_1.Angle.FromDegrees(0), ValueObjects_1.Angle.FromDegrees(0));
|
|
49
49
|
if (this.repoLabel) {
|
|
50
|
-
callout.label.default = this.repoLabel.
|
|
50
|
+
callout.label.default = this.repoLabel.display;
|
|
51
51
|
}
|
|
52
52
|
if (this.calloutGlobals) {
|
|
53
53
|
callout.size = this.calloutGlobals.lastSize;
|
|
@@ -3,6 +3,7 @@ export declare class Hideable extends AppObjectEntity {
|
|
|
3
3
|
static readonly type = "HIDEABLE";
|
|
4
4
|
static addIfMissing(appObj: AppObject): Hideable;
|
|
5
5
|
static get(appObjID: string, appObjects: AppObjectRepo): Hideable | undefined;
|
|
6
|
+
ignoreSerialization: boolean;
|
|
6
7
|
private memoizedIsHidden;
|
|
7
8
|
get isHidden(): boolean;
|
|
8
9
|
set isHidden(val: boolean);
|
|
@@ -6,6 +6,7 @@ const Entities_1 = require("../../../Entities");
|
|
|
6
6
|
class Hideable extends AppObject_1.AppObjectEntity {
|
|
7
7
|
constructor(appObject) {
|
|
8
8
|
super(appObject, Hideable.type);
|
|
9
|
+
this.ignoreSerialization = false;
|
|
9
10
|
this.memoizedIsHidden = new Entities_1.MemoizedBoolean(false, this.notifyOnChange);
|
|
10
11
|
}
|
|
11
12
|
static addIfMissing(appObj) {
|
|
@@ -35,7 +35,7 @@ class SerializeHideableObjectsImp extends SerializeHideableObjects {
|
|
|
35
35
|
const hiddenObjects = [];
|
|
36
36
|
const allHideables = this.appObjects.getAllComponents(Hideable_1.Hideable.type);
|
|
37
37
|
allHideables.forEach((hideable) => {
|
|
38
|
-
if (hideable.isHidden)
|
|
38
|
+
if (hideable.isHidden && !hideable.ignoreSerialization)
|
|
39
39
|
hiddenObjects.push(hideable.appObject.id);
|
|
40
40
|
});
|
|
41
41
|
const state = {
|
|
@@ -28,11 +28,18 @@ function setupLandmarks(appObjects) {
|
|
|
28
28
|
OverlayColor_1.makeOverlayColorPM(previewAO);
|
|
29
29
|
Selection_1.makeSelectableStatePM(previewAO);
|
|
30
30
|
Hideable_1.makeIsHiddenPM(previewAO);
|
|
31
|
+
const previewHidable = Hideable_1.Hideable.get(previewAO.id, appObjects);
|
|
32
|
+
if (previewHidable) {
|
|
33
|
+
previewHidable.ignoreSerialization = true;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
appObjects.submitError("setupLandmarks", "Unable to find Hideable on preview landmark");
|
|
37
|
+
}
|
|
31
38
|
globals.previewLandmark = preview;
|
|
32
39
|
// Setup Tool
|
|
33
40
|
const toolRepo = Tools_1.ToolRepository.get(appObjects);
|
|
34
41
|
if (!toolRepo) {
|
|
35
|
-
appObjects.
|
|
42
|
+
appObjects.submitError("setupLandmarks", "Unable to find tool repo");
|
|
36
43
|
return landmarksAO;
|
|
37
44
|
}
|
|
38
45
|
toolRepo.makeToolFromData({
|
|
@@ -5,6 +5,7 @@ const AppObject_1 = require("../../../AppObject");
|
|
|
5
5
|
const AppObjectUC_1 = require("../../../AppObject/AppObjectUC");
|
|
6
6
|
const Babylon_1 = require("../../Babylon");
|
|
7
7
|
const BaseApp_1 = require("../../BaseApp");
|
|
8
|
+
const Tools_1 = require("../../Tools");
|
|
8
9
|
const Selectable_1 = require("../Entities/Selectable");
|
|
9
10
|
const Selection_1 = require("../Entities/Selection");
|
|
10
11
|
class SelectAppObjectUC extends AppObjectUC_1.AppObjectUC {
|
|
@@ -28,9 +29,16 @@ class SelectAppObjectUCImp extends SelectAppObjectUC {
|
|
|
28
29
|
return this.baseApp.isAuthoring;
|
|
29
30
|
};
|
|
30
31
|
this.allowTrySelect = () => {
|
|
32
|
+
var _a, _b, _c, _d;
|
|
31
33
|
if (!this.baseApp) {
|
|
32
34
|
return false;
|
|
33
35
|
}
|
|
36
|
+
if (((_b = (_a = this.toolRepo) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.toolType) === "CALLOUT") {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
if (((_d = (_c = this.toolRepo) === null || _c === void 0 ? void 0 : _c.activeTool) === null || _d === void 0 ? void 0 : _d.toolType) === "LANDMARK") {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
34
42
|
return this.baseApp.isAuthoring;
|
|
35
43
|
};
|
|
36
44
|
this.trySelectAppObject = (ray) => {
|
|
@@ -70,4 +78,7 @@ class SelectAppObjectUCImp extends SelectAppObjectUC {
|
|
|
70
78
|
get baseApp() {
|
|
71
79
|
return this.getCachedSingleton(BaseApp_1.BaseAppState.type);
|
|
72
80
|
}
|
|
81
|
+
get toolRepo() {
|
|
82
|
+
return this.getCachedSingleton(Tools_1.ToolRepository.type);
|
|
83
|
+
}
|
|
73
84
|
}
|
|
@@ -13,6 +13,7 @@ export declare abstract class StylusEntity extends AppObjectEntity {
|
|
|
13
13
|
static clickTimeThresholdMS: number;
|
|
14
14
|
abstract registerController: (controller: StylusController) => void;
|
|
15
15
|
abstract updateButtonState: (button: number, isPressed: boolean) => void;
|
|
16
|
+
abstract getButtonState(button: number): boolean;
|
|
16
17
|
abstract readonly transform: Transform3D;
|
|
17
18
|
abstract get isInUse(): boolean;
|
|
18
19
|
abstract get pickRay(): ParametricLine;
|
|
@@ -52,6 +52,14 @@ class StylusImp extends StylusEntity {
|
|
|
52
52
|
this.buttonStates[button] = isPressed;
|
|
53
53
|
this.notifyOnChange();
|
|
54
54
|
};
|
|
55
|
+
this.getButtonState = (button) => {
|
|
56
|
+
if (button < 0 || button >= this.buttonStates.length) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return this.buttonStates[button];
|
|
61
|
+
}
|
|
62
|
+
};
|
|
55
63
|
this.isClick = (button) => {
|
|
56
64
|
const buttonIsCorrect = button === this.lassPressedButton;
|
|
57
65
|
const movement = ValueObjects_1.Vector3.Subtract(this.transform.localPosition, this.pressPosition).magnitude;
|
package/package.json
CHANGED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { EaseFn } from "../Types";
|
|
2
|
-
/**
|
|
3
|
-
* Configuration object for performing a linear interpolation (lerp) operation.
|
|
4
|
-
* @interface LerpNumberDTO
|
|
5
|
-
*/
|
|
6
|
-
export interface LerpNumberDTO {
|
|
7
|
-
/** Starting value of the lerp */
|
|
8
|
-
start: number;
|
|
9
|
-
/** Target/ending value of the lerp */
|
|
10
|
-
end: number;
|
|
11
|
-
/** Callback function that receives the interpolated value on each update */
|
|
12
|
-
update: (value: number) => void;
|
|
13
|
-
/** Duration of the lerp in milliseconds. Defaults to LerpNumber.defaultDurationMS */
|
|
14
|
-
durationMS?: number;
|
|
15
|
-
/** Easing function to modify the interpolation curve. Defaults to LerpNumber.defaultEase */
|
|
16
|
-
ease?: EaseFn;
|
|
17
|
-
/** Optional callback function called when lerp completes naturally */
|
|
18
|
-
onComplete?: () => void;
|
|
19
|
-
/** Optional callback function called when lerp is cancelled */
|
|
20
|
-
onCancel?: () => void;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Utility class for smoothly interpolating between two numbers over time.
|
|
24
|
-
* Uses requestAnimationFrame for smooth animation and supports custom easing functions.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* const lerper = new LerpNumber();
|
|
28
|
-
* // Animate from 0 to 100 over 2 seconds
|
|
29
|
-
* await lerper.lerp({
|
|
30
|
-
* start: 0,
|
|
31
|
-
* end: 100,
|
|
32
|
-
* durationMS: 2000,
|
|
33
|
-
* update: (value) => console.log(value)
|
|
34
|
-
* });
|
|
35
|
-
*/
|
|
36
|
-
export declare class LerpNumber {
|
|
37
|
-
defaultDurationMS: number;
|
|
38
|
-
defaultEase: EaseFn;
|
|
39
|
-
get isLerping(): boolean;
|
|
40
|
-
private _isLerping;
|
|
41
|
-
/**
|
|
42
|
-
* Cancels the current lerp operation if one is in progress.
|
|
43
|
-
* Triggers the onCancel callback if provided in the original lerp configuration.
|
|
44
|
-
*/
|
|
45
|
-
cancel(): void;
|
|
46
|
-
private _cancelLerp;
|
|
47
|
-
/**
|
|
48
|
-
* Initiates a lerp (linear interpolation) operation.
|
|
49
|
-
* If a lerp is already in progress, it will be cancelled before starting the new one.
|
|
50
|
-
*
|
|
51
|
-
* @param data - Configuration object for the lerp operation
|
|
52
|
-
* @returns Promise that resolves when the lerp completes or is cancelled
|
|
53
|
-
* @throws Never throws, but may reject if the update function throws
|
|
54
|
-
*/
|
|
55
|
-
lerp: (data: LerpNumberDTO) => Promise<void>;
|
|
56
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LerpNumber = void 0;
|
|
4
|
-
const easeFunctions_1 = require("./easeFunctions");
|
|
5
|
-
/**
|
|
6
|
-
* Utility class for smoothly interpolating between two numbers over time.
|
|
7
|
-
* Uses requestAnimationFrame for smooth animation and supports custom easing functions.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* const lerper = new LerpNumber();
|
|
11
|
-
* // Animate from 0 to 100 over 2 seconds
|
|
12
|
-
* await lerper.lerp({
|
|
13
|
-
* start: 0,
|
|
14
|
-
* end: 100,
|
|
15
|
-
* durationMS: 2000,
|
|
16
|
-
* update: (value) => console.log(value)
|
|
17
|
-
* });
|
|
18
|
-
*/
|
|
19
|
-
class LerpNumber {
|
|
20
|
-
constructor() {
|
|
21
|
-
this.defaultDurationMS = 1000;
|
|
22
|
-
this.defaultEase = easeFunctions_1.quintInOut;
|
|
23
|
-
this._isLerping = false;
|
|
24
|
-
this._cancelLerp = false;
|
|
25
|
-
/**
|
|
26
|
-
* Initiates a lerp (linear interpolation) operation.
|
|
27
|
-
* If a lerp is already in progress, it will be cancelled before starting the new one.
|
|
28
|
-
*
|
|
29
|
-
* @param data - Configuration object for the lerp operation
|
|
30
|
-
* @returns Promise that resolves when the lerp completes or is cancelled
|
|
31
|
-
* @throws Never throws, but may reject if the update function throws
|
|
32
|
-
*/
|
|
33
|
-
this.lerp = (data) => {
|
|
34
|
-
if (this._isLerping) {
|
|
35
|
-
this.cancel();
|
|
36
|
-
}
|
|
37
|
-
const { start, end, durationMS, ease, onComplete, update, onCancel } = data;
|
|
38
|
-
const durationToUse = durationMS !== null && durationMS !== void 0 ? durationMS : this.defaultDurationMS;
|
|
39
|
-
const easeToUse = ease !== null && ease !== void 0 ? ease : this.defaultEase;
|
|
40
|
-
return new Promise((resolve) => {
|
|
41
|
-
const startTime = performance.now();
|
|
42
|
-
this._isLerping = true;
|
|
43
|
-
update(start);
|
|
44
|
-
const doLerp = (currentTime) => {
|
|
45
|
-
if (this._cancelLerp) {
|
|
46
|
-
this._isLerping = false;
|
|
47
|
-
this._cancelLerp = false;
|
|
48
|
-
if (onCancel)
|
|
49
|
-
onCancel();
|
|
50
|
-
return resolve();
|
|
51
|
-
}
|
|
52
|
-
const elapsedTime = currentTime - startTime;
|
|
53
|
-
const progress = Math.min(elapsedTime / durationToUse, 1);
|
|
54
|
-
const easedProgress = easeToUse(progress);
|
|
55
|
-
const value = start + (end - start) * easedProgress;
|
|
56
|
-
update(value);
|
|
57
|
-
if (progress < 1) {
|
|
58
|
-
requestAnimationFrame(doLerp);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
this._isLerping = false;
|
|
62
|
-
update(end);
|
|
63
|
-
if (onComplete)
|
|
64
|
-
onComplete();
|
|
65
|
-
resolve();
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
requestAnimationFrame(doLerp);
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
get isLerping() {
|
|
73
|
-
return this._isLerping;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Cancels the current lerp operation if one is in progress.
|
|
77
|
-
* Triggers the onCancel callback if provided in the original lerp configuration.
|
|
78
|
-
*/
|
|
79
|
-
cancel() {
|
|
80
|
-
if (!this._isLerping)
|
|
81
|
-
return;
|
|
82
|
-
this._cancelLerp = true;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
exports.LerpNumber = LerpNumber;
|