@vived/app 4.18.1 → 4.19.1
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/Entities/ChannelModel.d.ts +22 -2
- package/lib/Components/ChannelModel/Entities/ChannelModel.js +48 -27
- package/lib/Components/ChannelModel/Mocks/ChannelModelViewFactoryMock.d.ts +9 -0
- package/lib/Components/ChannelModel/Mocks/ChannelModelViewFactoryMock.js +16 -0
- package/lib/Components/ChannelModel/Mocks/index.d.ts +1 -1
- package/lib/Components/ChannelModel/Mocks/index.js +1 -1
- package/lib/Components/ChannelModel/UC/ChannelModelViewFactory.d.ts +8 -0
- package/lib/Components/ChannelModel/UC/ChannelModelViewFactory.js +11 -0
- package/lib/Components/ChannelModel/UC/index.d.ts +1 -3
- package/lib/Components/ChannelModel/UC/index.js +1 -3
- package/lib/Components/GLBModel/Entities/GblModelRepo.d.ts +2 -2
- package/lib/Components/GLBModel/Entities/GblModelRepo.js +3 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppObject, AppObjectEntity, AppObjectRepo } from "../../../AppObject";
|
|
2
|
-
import { Quaternion, Vector3 } from "../../../ValueObjects";
|
|
2
|
+
import { Quaternion, QuaternionDTO, Vector3, Vector3DTO } from "../../../ValueObjects";
|
|
3
3
|
import { ChannelModelObject } from "./ChannelModelObject";
|
|
4
4
|
export declare enum ChannelModelState {
|
|
5
5
|
INIT = "Initialized",
|
|
@@ -27,7 +27,9 @@ export declare abstract class ChannelModelEntity extends AppObjectEntity {
|
|
|
27
27
|
abstract get modelError(): Error | undefined;
|
|
28
28
|
abstract set modelError(val: Error | undefined);
|
|
29
29
|
abstract get modelObjectIds(): string[];
|
|
30
|
-
abstract get
|
|
30
|
+
abstract get rootRotation(): Quaternion;
|
|
31
|
+
abstract set rootRotation(val: Quaternion);
|
|
32
|
+
abstract get data(): ChannelModelDTO;
|
|
31
33
|
abstract setupFromData(data: object): void;
|
|
32
34
|
abstract originalCollectionID?: string;
|
|
33
35
|
abstract modelObjectFactory(id: string): ChannelModelObject;
|
|
@@ -38,6 +40,24 @@ export declare abstract class ChannelModelEntity extends AppObjectEntity {
|
|
|
38
40
|
static get(id: string, appObjects: AppObjectRepo): ChannelModelEntity | undefined;
|
|
39
41
|
}
|
|
40
42
|
export declare function makeChannelModelEntity(appObject: AppObject): ChannelModelEntity;
|
|
43
|
+
export interface ChannelModelDTO {
|
|
44
|
+
bounds_min: Vector3DTO;
|
|
45
|
+
bounds_max: Vector3DTO;
|
|
46
|
+
version: number;
|
|
47
|
+
objects: ChannelModelObjectDTO[];
|
|
48
|
+
name: string;
|
|
49
|
+
defaultPosition: Vector3DTO;
|
|
50
|
+
defaultRotation: QuaternionDTO;
|
|
51
|
+
defaultScale: number;
|
|
52
|
+
originalCollectionID?: string;
|
|
53
|
+
rootRotation: QuaternionDTO;
|
|
54
|
+
}
|
|
55
|
+
export interface ChannelModelObjectDTO {
|
|
56
|
+
id: string;
|
|
57
|
+
meshPaths: string[];
|
|
58
|
+
label: string;
|
|
59
|
+
tags: string[];
|
|
60
|
+
}
|
|
41
61
|
export interface ChannelModelDTOv2 {
|
|
42
62
|
version: 2;
|
|
43
63
|
objects: ChannelModelDataMeshDTOv2[];
|
|
@@ -38,8 +38,30 @@ class ChannelModelEntityImp extends ChannelModelEntity {
|
|
|
38
38
|
this._defaultPosition = new Entities_1.MemoizedVector3(ValueObjects_1.Vector3.Zero(), this.notifyOnChange);
|
|
39
39
|
this._defaultRotation = new Entities_1.MemoizedQuaternion(ValueObjects_1.Quaternion.Identity(), this.notifyOnChange);
|
|
40
40
|
this._defaultScale = new Entities_1.MemoizedNumber(1, this.notifyOnChange);
|
|
41
|
+
this._rootRotation = new Entities_1.MemoizedQuaternion(ValueObjects_1.Quaternion.Identity(), this.notifyOnChange);
|
|
41
42
|
this._state = new Entities_1.MemoizedString(ChannelModelState.INIT, this.notifyOnChange);
|
|
42
43
|
this.modelObjectLookup = new Map();
|
|
44
|
+
this.modelObjectFactory = (id) => {
|
|
45
|
+
const ao = this.appObjects.getOrCreate(id);
|
|
46
|
+
return ChannelModelObject_1.makeChannelModelObject(ao);
|
|
47
|
+
};
|
|
48
|
+
this.addModelObject = (id) => {
|
|
49
|
+
const idToUse = id !== null && id !== void 0 ? id : Utilities_1.generateUniqueID();
|
|
50
|
+
const obj = this.modelObjectFactory(idToUse);
|
|
51
|
+
this.modelObjectLookup.set(idToUse, obj);
|
|
52
|
+
obj.addChangeObserver(this.notifyOnChange);
|
|
53
|
+
this.notifyOnChange();
|
|
54
|
+
return obj;
|
|
55
|
+
};
|
|
56
|
+
this.getModelObject = (id) => {
|
|
57
|
+
return this.modelObjectLookup.get(id);
|
|
58
|
+
};
|
|
59
|
+
this.hasModelObject = (id) => {
|
|
60
|
+
return this.modelObjectLookup.has(id);
|
|
61
|
+
};
|
|
62
|
+
this.modelObjects = () => {
|
|
63
|
+
return Array.from(this.modelObjectLookup.values());
|
|
64
|
+
};
|
|
43
65
|
this.setupFromData = (data) => {
|
|
44
66
|
if ("bounds_max" in data) {
|
|
45
67
|
this.bounds_max = ValueObjects_1.Vector3.FromDTO(data.bounds_max);
|
|
@@ -65,6 +87,12 @@ class ChannelModelEntityImp extends ChannelModelEntity {
|
|
|
65
87
|
else {
|
|
66
88
|
this.defaultRotation = ValueObjects_1.Quaternion.Identity();
|
|
67
89
|
}
|
|
90
|
+
if ("rootRotation" in data) {
|
|
91
|
+
this.rootRotation = ValueObjects_1.Quaternion.FromDTO(data.rootRotation);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this.rootRotation = ValueObjects_1.Quaternion.Identity();
|
|
95
|
+
}
|
|
68
96
|
if ("defaultScale" in data) {
|
|
69
97
|
this.defaultScale = data.defaultScale;
|
|
70
98
|
}
|
|
@@ -83,11 +111,18 @@ class ChannelModelEntityImp extends ChannelModelEntity {
|
|
|
83
111
|
if ("objects" in data) {
|
|
84
112
|
const objects = data.objects;
|
|
85
113
|
objects.forEach((obj) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
114
|
+
if ("id" in obj) {
|
|
115
|
+
const modelObj = this.addModelObject(obj.id);
|
|
116
|
+
if ("label" in obj) {
|
|
117
|
+
modelObj.label = obj.label;
|
|
118
|
+
}
|
|
119
|
+
if ("meshPaths" in obj) {
|
|
120
|
+
modelObj.subMeshPaths = obj.meshPaths;
|
|
121
|
+
}
|
|
122
|
+
if ("tags" in obj) {
|
|
123
|
+
modelObj.tags = obj.tags;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
91
126
|
});
|
|
92
127
|
}
|
|
93
128
|
};
|
|
@@ -131,6 +166,12 @@ class ChannelModelEntityImp extends ChannelModelEntity {
|
|
|
131
166
|
set defaultScale(scale) {
|
|
132
167
|
this._defaultScale.val = scale;
|
|
133
168
|
}
|
|
169
|
+
get rootRotation() {
|
|
170
|
+
return this._rootRotation.val;
|
|
171
|
+
}
|
|
172
|
+
set rootRotation(rotation) {
|
|
173
|
+
this._rootRotation.val = rotation;
|
|
174
|
+
}
|
|
134
175
|
get state() {
|
|
135
176
|
return this._state.val;
|
|
136
177
|
}
|
|
@@ -144,27 +185,6 @@ class ChannelModelEntityImp extends ChannelModelEntity {
|
|
|
144
185
|
this._error = val;
|
|
145
186
|
this._state.val = ChannelModelState.ERROR;
|
|
146
187
|
}
|
|
147
|
-
modelObjectFactory(id) {
|
|
148
|
-
const ao = this.appObjects.getOrCreate(id);
|
|
149
|
-
return ChannelModelObject_1.makeChannelModelObject(ao);
|
|
150
|
-
}
|
|
151
|
-
addModelObject(id) {
|
|
152
|
-
const idToUse = id !== null && id !== void 0 ? id : Utilities_1.generateUniqueID();
|
|
153
|
-
const obj = this.modelObjectFactory(idToUse);
|
|
154
|
-
this.modelObjectLookup.set(idToUse, obj);
|
|
155
|
-
obj.addChangeObserver(this.notifyOnChange);
|
|
156
|
-
this.notifyOnChange();
|
|
157
|
-
return obj;
|
|
158
|
-
}
|
|
159
|
-
getModelObject(id) {
|
|
160
|
-
return this.modelObjectLookup.get(id);
|
|
161
|
-
}
|
|
162
|
-
hasModelObject(id) {
|
|
163
|
-
return this.modelObjectLookup.has(id);
|
|
164
|
-
}
|
|
165
|
-
modelObjects() {
|
|
166
|
-
return Array.from(this.modelObjectLookup.values());
|
|
167
|
-
}
|
|
168
188
|
get modelObjectIds() {
|
|
169
189
|
return Array.from(this.modelObjectLookup.keys());
|
|
170
190
|
}
|
|
@@ -186,8 +206,9 @@ class ChannelModelEntityImp extends ChannelModelEntity {
|
|
|
186
206
|
defaultScale: this._defaultScale.val,
|
|
187
207
|
name: this._name.val,
|
|
188
208
|
objects,
|
|
189
|
-
version:
|
|
209
|
+
version: 1,
|
|
190
210
|
originalCollectionID: this.originalCollectionID,
|
|
211
|
+
rootRotation: this._rootRotation.val.dto,
|
|
191
212
|
};
|
|
192
213
|
}
|
|
193
214
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { AppObject, AppObjectRepo } from "../../../AppObject";
|
|
3
|
+
import { ChannelModelViewFactory } from "../UC/ChannelModelViewFactory";
|
|
4
|
+
export declare class ChannelModelViewFactoryMock extends ChannelModelViewFactory {
|
|
5
|
+
disposeView: jest.Mock<any, any>;
|
|
6
|
+
initializeView: jest.Mock<any, any>;
|
|
7
|
+
constructor(appObject: AppObject);
|
|
8
|
+
}
|
|
9
|
+
export declare function makeChannelModelViewFactoryMock(appObjects: AppObjectRepo): ChannelModelViewFactoryMock;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeChannelModelViewFactoryMock = exports.ChannelModelViewFactoryMock = void 0;
|
|
4
|
+
const ChannelModelViewFactory_1 = require("../UC/ChannelModelViewFactory");
|
|
5
|
+
class ChannelModelViewFactoryMock extends ChannelModelViewFactory_1.ChannelModelViewFactory {
|
|
6
|
+
constructor(appObject) {
|
|
7
|
+
super(appObject, ChannelModelViewFactory_1.ChannelModelViewFactory.type);
|
|
8
|
+
this.disposeView = jest.fn();
|
|
9
|
+
this.initializeView = jest.fn();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.ChannelModelViewFactoryMock = ChannelModelViewFactoryMock;
|
|
13
|
+
function makeChannelModelViewFactoryMock(appObjects) {
|
|
14
|
+
return new ChannelModelViewFactoryMock(appObjects.getOrCreate("ChannelModelViewFactoryMock"));
|
|
15
|
+
}
|
|
16
|
+
exports.makeChannelModelViewFactoryMock = makeChannelModelViewFactoryMock;
|
|
@@ -12,4 +12,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./ChannelModelObjectPMMock"), exports);
|
|
14
14
|
__exportStar(require("./ChannelModelPMMock"), exports);
|
|
15
|
-
__exportStar(require("./
|
|
15
|
+
__exportStar(require("./ChannelModelViewFactoryMock"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AppObjectRepo, AppObjectUC } from "../../../AppObject";
|
|
2
|
+
import { ChannelModelEntity } from "../Entities";
|
|
3
|
+
export declare abstract class ChannelModelViewFactory extends AppObjectUC {
|
|
4
|
+
static type: string;
|
|
5
|
+
abstract initializeView(channelModel: ChannelModelEntity): void;
|
|
6
|
+
abstract disposeView(id: string): void;
|
|
7
|
+
static get(appObjects: AppObjectRepo): ChannelModelViewFactory | undefined;
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChannelModelViewFactory = void 0;
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
|
+
class ChannelModelViewFactory extends AppObject_1.AppObjectUC {
|
|
6
|
+
static get(appObjects) {
|
|
7
|
+
return AppObject_1.getSingletonComponent(ChannelModelViewFactory.type, appObjects);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ChannelModelViewFactory = ChannelModelViewFactory;
|
|
11
|
+
ChannelModelViewFactory.type = "ChannelModelViewFactory";
|
|
@@ -10,6 +10,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./
|
|
14
|
-
__exportStar(require("./SelectChannelModelUC"), exports);
|
|
15
|
-
__exportStar(require("./SetupChannelModelUC"), exports);
|
|
13
|
+
__exportStar(require("./ChannelModelViewFactory"), exports);
|
|
@@ -2,8 +2,8 @@ import { AppObject, AppObjectEntityRepo, AppObjectRepo } from "../../../AppObjec
|
|
|
2
2
|
import { GlbModelEntity } from "./GlbModelEntity";
|
|
3
3
|
export declare abstract class GlbModelRepo extends AppObjectEntityRepo<GlbModelEntity> {
|
|
4
4
|
static type: string;
|
|
5
|
-
abstract
|
|
6
|
-
abstract
|
|
5
|
+
abstract glbModelFactory(id: string): GlbModelEntity;
|
|
6
|
+
abstract createGlbModel(id?: string): GlbModelEntity;
|
|
7
7
|
static get(appObjects: AppObjectRepo): GlbModelRepo | undefined;
|
|
8
8
|
}
|
|
9
9
|
export declare function makeGlbModelRepo(appObject: AppObject): GlbModelRepo;
|
|
@@ -18,13 +18,13 @@ exports.makeGlbModelRepo = makeGlbModelRepo;
|
|
|
18
18
|
class GlbModelRepoImp extends GlbModelRepo {
|
|
19
19
|
constructor(appObject) {
|
|
20
20
|
super(appObject, GlbModelRepo.type);
|
|
21
|
-
this.
|
|
21
|
+
this.glbModelFactory = (id) => {
|
|
22
22
|
const ao = this.appObjects.getOrCreate(id);
|
|
23
23
|
return GlbModelEntity_1.makeGlbModelEntity(ao);
|
|
24
24
|
};
|
|
25
|
-
this.
|
|
25
|
+
this.createGlbModel = (id) => {
|
|
26
26
|
const idToUse = id !== null && id !== void 0 ? id : Utilities_1.generateUniqueID();
|
|
27
|
-
const object = this.
|
|
27
|
+
const object = this.glbModelFactory(idToUse);
|
|
28
28
|
this.add(object);
|
|
29
29
|
return object;
|
|
30
30
|
};
|