@preference-sl/pref-viewer 2.10.0-beta.15 → 2.10.0-beta.16
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/package.json +1 -1
- package/src/index.js +59 -47
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -228,7 +228,7 @@ class PrefViewer extends HTMLElement {
|
|
|
228
228
|
this.shadowRoot.append(this.#wrapper);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
#setStatusSceneLoading(
|
|
231
|
+
#setStatusSceneLoading() {
|
|
232
232
|
this.loaded = false;
|
|
233
233
|
this.loading = true;
|
|
234
234
|
if (this.hasAttribute("loaded")) {
|
|
@@ -240,14 +240,40 @@ class PrefViewer extends HTMLElement {
|
|
|
240
240
|
bubbles: true,
|
|
241
241
|
cancelable: false,
|
|
242
242
|
composed: true,
|
|
243
|
-
detail: detail,
|
|
244
243
|
})
|
|
245
244
|
);
|
|
246
245
|
}
|
|
247
246
|
|
|
248
|
-
#setStatusSceneLoaded(
|
|
247
|
+
#setStatusSceneLoaded() {
|
|
249
248
|
this.loaded = true;
|
|
250
249
|
this.loading = false;
|
|
250
|
+
|
|
251
|
+
const toLoadDetail = {
|
|
252
|
+
container_model: !!this.#data.containers.model.changed,
|
|
253
|
+
container_environment: !!this.#data.containers.environment.changed,
|
|
254
|
+
container_materials: !!this.#data.containers.materials.changed,
|
|
255
|
+
options_camera: !!this.#data.options.camera.changed,
|
|
256
|
+
options_inneWallMaterial: !!this.#data.options.materials.innerWall.changed,
|
|
257
|
+
options_outerWallMaterial: !!this.#data.options.materials.outerWall.changed,
|
|
258
|
+
options_innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed,
|
|
259
|
+
options_outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed,
|
|
260
|
+
};
|
|
261
|
+
const loadedDetail = {
|
|
262
|
+
container_model: !!this.#data.containers.model.changed?.success,
|
|
263
|
+
container_environment: !!this.#data.containers.environment.changed?.success,
|
|
264
|
+
container_materials: !!this.#data.containers.materials.changed?.success,
|
|
265
|
+
options_camera: !!this.#data.options.camera.changed?.success,
|
|
266
|
+
options_inneWallMaterial: !!this.#data.options.materials.innerWall.changed?.success,
|
|
267
|
+
options_outerWallMaterial: !!this.#data.options.materials.outerWall.changed?.success,
|
|
268
|
+
options_innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed?.success,
|
|
269
|
+
options_outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed?.success,
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
const detail = {
|
|
273
|
+
tried: toLoadDetail,
|
|
274
|
+
success: loadedDetail,
|
|
275
|
+
};
|
|
276
|
+
|
|
251
277
|
if (this.hasAttribute("loading")) {
|
|
252
278
|
this.removeAttribute("loading");
|
|
253
279
|
}
|
|
@@ -262,18 +288,36 @@ class PrefViewer extends HTMLElement {
|
|
|
262
288
|
);
|
|
263
289
|
}
|
|
264
290
|
|
|
265
|
-
#setStatusOptionsLoading(
|
|
291
|
+
#setStatusOptionsLoading() {
|
|
266
292
|
this.dispatchEvent(
|
|
267
293
|
new CustomEvent("options-loading", {
|
|
268
294
|
bubbles: true,
|
|
269
295
|
cancelable: false,
|
|
270
296
|
composed: true,
|
|
271
|
-
detail: detail,
|
|
272
297
|
})
|
|
273
298
|
);
|
|
274
299
|
}
|
|
275
300
|
|
|
276
|
-
#setStatusOptionsLoaded(
|
|
301
|
+
#setStatusOptionsLoaded() {
|
|
302
|
+
|
|
303
|
+
const toLoadDetail = {
|
|
304
|
+
inneWallMaterial: !!this.#data.options.materials.innerWall.changed,
|
|
305
|
+
outerWallMaterial: !!this.#data.options.materials.outerWall.changed,
|
|
306
|
+
innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed,
|
|
307
|
+
outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed,
|
|
308
|
+
};
|
|
309
|
+
const loadedDetail = {
|
|
310
|
+
inneWallMaterial: !!this.#data.options.materials.innerWall.changed?.success,
|
|
311
|
+
outerWallMaterial: !!this.#data.options.materials.outerWall.changed?.success,
|
|
312
|
+
innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed?.success,
|
|
313
|
+
_outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed?.success,
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
const detail = {
|
|
317
|
+
tried: toLoadDetail,
|
|
318
|
+
success: loadedDetail,
|
|
319
|
+
};
|
|
320
|
+
|
|
277
321
|
this.dispatchEvent(
|
|
278
322
|
new CustomEvent("options-loaded", {
|
|
279
323
|
bubbles: true,
|
|
@@ -520,6 +564,7 @@ class PrefViewer extends HTMLElement {
|
|
|
520
564
|
}
|
|
521
565
|
|
|
522
566
|
#setOptionsMaterial(optionMaterial) {
|
|
567
|
+
debugger;
|
|
523
568
|
if (!optionMaterial || !optionMaterial.prefix || !optionMaterial.value) {
|
|
524
569
|
return false;
|
|
525
570
|
}
|
|
@@ -530,10 +575,10 @@ class PrefViewer extends HTMLElement {
|
|
|
530
575
|
}
|
|
531
576
|
|
|
532
577
|
const containers = [];
|
|
533
|
-
if (this.#data.containers.model.assetContainer && (this.#data.containers.model.changed || optionMaterial.changed)) {
|
|
578
|
+
if (this.#data.containers.model.assetContainer && (this.#data.containers.model.changed || this.#data.containers.materials.changed || optionMaterial.changed)) {
|
|
534
579
|
containers.push(this.#data.containers.model.assetContainer);
|
|
535
580
|
}
|
|
536
|
-
if (this.#data.containers.environment.assetContainer && (this.#data.containers.environment.changed || optionMaterial.changed)) {
|
|
581
|
+
if (this.#data.containers.environment.assetContainer && (this.#data.containers.environment.changed || this.#data.containers.materials.changed || optionMaterial.changed)) {
|
|
537
582
|
containers.push(this.#data.containers.environment.assetContainer);
|
|
538
583
|
}
|
|
539
584
|
if (containers.length === 0) {
|
|
@@ -689,7 +734,7 @@ class PrefViewer extends HTMLElement {
|
|
|
689
734
|
promiseArray.push(loadModel ? this.#loadAssetContainer(this.#data.containers.model) : false);
|
|
690
735
|
promiseArray.push(loadEnvironment ? this.#loadAssetContainer(this.#data.containers.environment) : false);
|
|
691
736
|
promiseArray.push(loadMaterials ? this.#loadAssetContainer(this.#data.containers.materials) : false);
|
|
692
|
-
|
|
737
|
+
debugger;
|
|
693
738
|
const loadingDetail = {
|
|
694
739
|
model: !!this.#data.containers.model.changed,
|
|
695
740
|
environment: !!this.#data.containers.environment.changed,
|
|
@@ -732,22 +777,7 @@ class PrefViewer extends HTMLElement {
|
|
|
732
777
|
this.#setOptionsMaterials();
|
|
733
778
|
this.#setOptionsCamera();
|
|
734
779
|
this.#setVisibilityOfWallAndFloorInModel();
|
|
735
|
-
|
|
736
|
-
const loadedDetail = {
|
|
737
|
-
model: !!this.#data.containers.model.changed?.success,
|
|
738
|
-
environment: !!this.#data.containers.environment.changed?.success,
|
|
739
|
-
materials: !!this.#data.containers.materials.changed?.success,
|
|
740
|
-
options: {
|
|
741
|
-
camera: !!this.#data.options.camera.changed?.success,
|
|
742
|
-
inneWallMaterial: !!this.#data.options.materials.innerWall.changed?.success,
|
|
743
|
-
outerWallMaterial: !!this.#data.options.materials.outerWall.changed?.success,
|
|
744
|
-
innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed?.success,
|
|
745
|
-
outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed?.success,
|
|
746
|
-
},
|
|
747
|
-
};
|
|
748
|
-
|
|
749
|
-
this.#setStatusSceneLoaded(loadedDetail);
|
|
750
|
-
|
|
780
|
+
this.#setStatusSceneLoaded();
|
|
751
781
|
this.#resetChangedFlags();
|
|
752
782
|
})
|
|
753
783
|
.catch((error) => {
|
|
@@ -792,35 +822,17 @@ class PrefViewer extends HTMLElement {
|
|
|
792
822
|
return false;
|
|
793
823
|
}
|
|
794
824
|
|
|
795
|
-
|
|
796
|
-
const materialsChanged = this.#checkMaterialsChanged(options);
|
|
797
|
-
|
|
798
|
-
const loadingDetail = {
|
|
799
|
-
camera: !!this.#data.options.camera.changed,
|
|
800
|
-
inneWallMaterial: !!this.#data.options.materials.innerWall.changed,
|
|
801
|
-
outerWallMaterial: !!this.#data.options.materials.outerWall.changed,
|
|
802
|
-
innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed,
|
|
803
|
-
outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed,
|
|
804
|
-
};
|
|
805
|
-
this.#setStatusOptionsLoading(loadingDetail);
|
|
825
|
+
this.#setStatusOptionsLoading();
|
|
806
826
|
|
|
807
827
|
let someSetted = false;
|
|
808
|
-
if (
|
|
828
|
+
if (this.#checkCameraChanged(options)) {
|
|
809
829
|
someSetted = someSetted || this.#setOptionsCamera();
|
|
810
830
|
}
|
|
811
|
-
if (
|
|
831
|
+
if (this.#checkMaterialsChanged(options)) {
|
|
812
832
|
someSetted = someSetted || this.#setOptionsMaterials();
|
|
813
833
|
}
|
|
814
834
|
|
|
815
|
-
|
|
816
|
-
camera: !!this.#data.options.camera.changed?.success,
|
|
817
|
-
inneWallMaterial: !!this.#data.options.materials.innerWall.changed?.success,
|
|
818
|
-
outerWallMaterial: !!this.#data.options.materials.outerWall.changed?.success,
|
|
819
|
-
innerFloorMaterial: !!this.#data.options.materials.innerFloor.changed?.success,
|
|
820
|
-
outerFloorMaterial: !!this.#data.options.materials.outerFloor.changed?.success,
|
|
821
|
-
};
|
|
822
|
-
this.#setStatusOptionsLoaded(loadedDetail);
|
|
823
|
-
|
|
835
|
+
this.#setStatusOptionsLoaded();
|
|
824
836
|
this.#resetChangedFlags();
|
|
825
837
|
|
|
826
838
|
return someSetted;
|