@vived/app 4.34.9 → 4.34.10
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/Entities/CalloutRepo.d.ts +1 -0
- package/lib/Components/Callouts/Entities/CalloutRepo.js +9 -3
- package/lib/Components/Callouts/UC/LookAtCameraUC.js +7 -7
- package/lib/Components/Landmarks/Entities/LandmarkRepo.d.ts +2 -1
- package/lib/Components/Landmarks/Entities/LandmarkRepo.js +7 -1
- package/lib/Components/Selection/PM/SelectableStatePM.d.ts +1 -0
- package/lib/Components/Selection/PM/SelectableStatePM.js +19 -5
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ export declare abstract class CalloutRepo extends AppObjectEntityRepo<CalloutEnt
|
|
|
8
8
|
abstract calloutFactory(id: string): CalloutEntity;
|
|
9
9
|
abstract makeCallout(id?: string): CalloutEntity;
|
|
10
10
|
abstract deleteCallout(id: string): void;
|
|
11
|
+
abstract applySurrogateTransform(transform: Transform3D): void;
|
|
11
12
|
static get(appObj: AppObject): CalloutRepo | undefined;
|
|
12
13
|
static getById(id: string, appObjects: AppObjectRepo): CalloutRepo | undefined;
|
|
13
14
|
static addIfMissing(appObject: AppObject): CalloutRepo;
|
|
@@ -32,12 +32,15 @@ exports.makeCalloutRepoEntity = makeCalloutRepoEntity;
|
|
|
32
32
|
class CalloutRepoImp extends CalloutRepo {
|
|
33
33
|
constructor(appObject) {
|
|
34
34
|
super(appObject, CalloutRepo.type);
|
|
35
|
+
this.applySurrogateTransform = (transform) => {
|
|
36
|
+
this._transform = transform;
|
|
37
|
+
};
|
|
35
38
|
this.makeCallout = (id) => {
|
|
36
39
|
const idToUse = id !== null && id !== void 0 ? id : generateUniqueID_1.generateUniqueID();
|
|
37
40
|
const callout = this.calloutFactory(idToUse);
|
|
38
41
|
callout.inRepo = this;
|
|
39
|
-
callout.rootTransform.parent = this.
|
|
40
|
-
callout.labelTransform.parent = this.
|
|
42
|
+
callout.rootTransform.parent = this._transform;
|
|
43
|
+
callout.labelTransform.parent = this._transform;
|
|
41
44
|
this.add(callout);
|
|
42
45
|
return callout;
|
|
43
46
|
};
|
|
@@ -45,7 +48,10 @@ class CalloutRepoImp extends CalloutRepo {
|
|
|
45
48
|
const ao = this.appObjects.getOrCreate(id);
|
|
46
49
|
return CalloutEntity_1.makeCalloutEntity(ao);
|
|
47
50
|
};
|
|
48
|
-
this.
|
|
51
|
+
this._transform = Transform3D_1.Transform3D.addIfMissing(appObject);
|
|
52
|
+
}
|
|
53
|
+
get transform() {
|
|
54
|
+
return this._transform;
|
|
49
55
|
}
|
|
50
56
|
deleteCallout(id) {
|
|
51
57
|
const callout = this.getForAppObject(id);
|
|
@@ -31,8 +31,8 @@ class LookAtCameraUCIMP extends LookAtCameraUC {
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
const worldDir = ValueObjects_1.Vector3.Subtract(this.cameraPos, this.callout.labelTransform.worldPosition);
|
|
34
|
-
const localDir = parent.worldDirectionToLocal(worldDir);
|
|
35
|
-
const desiredQ = ValueObjects_1.Quaternion.FromDirectionVector(
|
|
34
|
+
// const localDir = parent.worldDirectionToLocal(worldDir);
|
|
35
|
+
const desiredQ = ValueObjects_1.Quaternion.FromDirectionVector(worldDir);
|
|
36
36
|
if (ValueObjects_1.Quaternion.Close(this.targetQ, desiredQ)) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
@@ -43,7 +43,7 @@ class LookAtCameraUCIMP extends LookAtCameraUC {
|
|
|
43
43
|
};
|
|
44
44
|
this.stopSlerping = () => {
|
|
45
45
|
if (this.callout) {
|
|
46
|
-
this.callout.labelTransform.
|
|
46
|
+
this.callout.labelTransform.worldRotation = this.targetQ;
|
|
47
47
|
}
|
|
48
48
|
if (this.slerpInterval) {
|
|
49
49
|
clearInterval(this.slerpInterval);
|
|
@@ -75,9 +75,9 @@ class LookAtCameraUCIMP extends LookAtCameraUC {
|
|
|
75
75
|
const transform = (_a = this.callout) === null || _a === void 0 ? void 0 : _a.labelTransform;
|
|
76
76
|
if (!transform)
|
|
77
77
|
return;
|
|
78
|
-
let previousError = ValueObjects_1.Quaternion.AngleBetween(transform.
|
|
78
|
+
let previousError = ValueObjects_1.Quaternion.AngleBetween(transform.worldRotation, this.targetQ).degrees;
|
|
79
79
|
this.slerpInterval = setInterval(() => {
|
|
80
|
-
const error = ValueObjects_1.Quaternion.AngleBetween(transform.
|
|
80
|
+
const error = ValueObjects_1.Quaternion.AngleBetween(transform.worldRotation, this.targetQ).degrees;
|
|
81
81
|
if (error < 0.15) {
|
|
82
82
|
this.stopSlerping();
|
|
83
83
|
return;
|
|
@@ -96,8 +96,8 @@ class LookAtCameraUCIMP extends LookAtCameraUC {
|
|
|
96
96
|
if (slerpPercent > 1) {
|
|
97
97
|
slerpPercent = 1;
|
|
98
98
|
}
|
|
99
|
-
const slerpedQ = ValueObjects_1.Quaternion.Slerp(transform.
|
|
100
|
-
transform.
|
|
99
|
+
const slerpedQ = ValueObjects_1.Quaternion.Slerp(transform.worldRotation, this.targetQ, slerpPercent);
|
|
100
|
+
transform.worldRotation = slerpedQ;
|
|
101
101
|
previousError = error;
|
|
102
102
|
}, 10);
|
|
103
103
|
}
|
|
@@ -4,10 +4,11 @@ import { LandmarkEntity } from "./LandmarkEntity";
|
|
|
4
4
|
export declare type LandmarkFactory = (id: string) => LandmarkEntity;
|
|
5
5
|
export declare abstract class LandmarkRepo extends AppObjectEntityRepo<LandmarkEntity> {
|
|
6
6
|
static readonly type = "LANDMARK_REPO";
|
|
7
|
-
abstract
|
|
7
|
+
abstract get transform(): Transform3D;
|
|
8
8
|
abstract landmarkFactory(id: string): LandmarkEntity;
|
|
9
9
|
abstract createLandmark(id?: string): LandmarkEntity;
|
|
10
10
|
abstract deleteLandmark(id: string): void;
|
|
11
|
+
abstract applySurrogateTransform(transform: Transform3D): void;
|
|
11
12
|
static get(appObj: AppObject): LandmarkRepo | undefined;
|
|
12
13
|
static getByID(id: string, appObjects: AppObjectRepo): LandmarkRepo | undefined;
|
|
13
14
|
static addIfMissing(appObject: AppObject): LandmarkRepo;
|
|
@@ -43,7 +43,13 @@ class LandmarkRepoImp extends LandmarkRepo {
|
|
|
43
43
|
const ao = this.appObjects.getOrCreate(id);
|
|
44
44
|
return LandmarkEntity_1.makeLandmarkEntity(ao);
|
|
45
45
|
};
|
|
46
|
-
this.
|
|
46
|
+
this._transform = Transform3D_1.Transform3D.addIfMissing(this.appObject);
|
|
47
|
+
}
|
|
48
|
+
get transform() {
|
|
49
|
+
return this._transform;
|
|
50
|
+
}
|
|
51
|
+
applySurrogateTransform(transform) {
|
|
52
|
+
this._transform = transform;
|
|
47
53
|
}
|
|
48
54
|
deleteLandmark(id) {
|
|
49
55
|
const landmark = this.getForAppObject(id);
|
|
@@ -5,6 +5,7 @@ export interface SelectableStateVM {
|
|
|
5
5
|
isSelected: boolean;
|
|
6
6
|
isPressed: boolean;
|
|
7
7
|
isHovered: boolean;
|
|
8
|
+
somethingElseIsSelected: boolean;
|
|
8
9
|
}
|
|
9
10
|
export declare const defaultSelectableStateVM: SelectableStateVM;
|
|
10
11
|
export declare abstract class SelectableStatePM extends AppObjectPM<SelectableStateVM> {
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeSelectableStatePM = exports.SelectableStatePM = exports.defaultSelectableStateVM = void 0;
|
|
4
4
|
const AppObjectPM_1 = require("../../../AppObject/AppObjectPM");
|
|
5
|
-
const
|
|
5
|
+
const Entities_1 = require("../Entities");
|
|
6
6
|
exports.defaultSelectableStateVM = {
|
|
7
7
|
isHovered: false,
|
|
8
8
|
isPressed: false,
|
|
9
9
|
isSelected: false,
|
|
10
|
+
somethingElseIsSelected: false,
|
|
10
11
|
};
|
|
11
12
|
class SelectableStatePM extends AppObjectPM_1.AppObjectPM {
|
|
12
13
|
static get(id, appObjects) {
|
|
@@ -23,28 +24,39 @@ function makeSelectableStatePM(appObject) {
|
|
|
23
24
|
exports.makeSelectableStatePM = makeSelectableStatePM;
|
|
24
25
|
class SelectableStatePMImp extends SelectableStatePM {
|
|
25
26
|
constructor(appObject) {
|
|
26
|
-
var _a;
|
|
27
|
+
var _a, _b;
|
|
27
28
|
super(appObject, SelectableStatePM.type);
|
|
28
29
|
this.onSelectionChange = () => {
|
|
29
|
-
if (!this.selectable)
|
|
30
|
+
if (!this.selectable || !this.selection)
|
|
30
31
|
return;
|
|
32
|
+
let somethingElseIsSelected = false;
|
|
33
|
+
const selectedObject = this.selection.selectedObjectId;
|
|
34
|
+
if (selectedObject !== null && selectedObject !== this.appObject.id) {
|
|
35
|
+
somethingElseIsSelected = true;
|
|
36
|
+
}
|
|
31
37
|
const vm = {
|
|
32
38
|
isHovered: this.selectable.hovered,
|
|
33
39
|
isPressed: this.selectable.pressed,
|
|
34
40
|
isSelected: this.selectable.selected,
|
|
41
|
+
somethingElseIsSelected,
|
|
35
42
|
};
|
|
36
43
|
this.doUpdateView(vm);
|
|
37
44
|
};
|
|
38
45
|
this.dispose = () => {
|
|
39
|
-
var _a;
|
|
46
|
+
var _a, _b;
|
|
40
47
|
super.dispose();
|
|
41
48
|
(_a = this.selectable) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onSelectionChange);
|
|
49
|
+
(_b = this.selection) === null || _b === void 0 ? void 0 : _b.removeChangeObserver(this.onSelectionChange);
|
|
42
50
|
};
|
|
43
51
|
(_a = this.selectable) === null || _a === void 0 ? void 0 : _a.addChangeObserver(this.onSelectionChange);
|
|
52
|
+
(_b = this.selection) === null || _b === void 0 ? void 0 : _b.addChangeObserver(this.onSelectionChange);
|
|
44
53
|
this.onSelectionChange();
|
|
45
54
|
}
|
|
46
55
|
get selectable() {
|
|
47
|
-
return this.getCachedLocalComponent(
|
|
56
|
+
return this.getCachedLocalComponent(Entities_1.Selectable.type);
|
|
57
|
+
}
|
|
58
|
+
get selection() {
|
|
59
|
+
return this.getCachedSingleton(Entities_1.Selection.type);
|
|
48
60
|
}
|
|
49
61
|
vmsAreEqual(a, b) {
|
|
50
62
|
if (a.isHovered !== b.isHovered)
|
|
@@ -53,6 +65,8 @@ class SelectableStatePMImp extends SelectableStatePM {
|
|
|
53
65
|
return false;
|
|
54
66
|
if (a.isSelected !== b.isSelected)
|
|
55
67
|
return false;
|
|
68
|
+
if (a.somethingElseIsSelected !== b.somethingElseIsSelected)
|
|
69
|
+
return false;
|
|
56
70
|
return true;
|
|
57
71
|
}
|
|
58
72
|
}
|