@preference-sl/pref-viewer 2.14.0-beta.0 → 2.14.0-beta.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preference-sl/pref-viewer",
3
- "version": "2.14.0-beta.0",
3
+ "version": "2.14.0-beta.2",
4
4
  "description": "Web Component to preview GLTF models with Babylon.js",
5
5
  "author": "Alex Moreno Palacio <amoreno@preference.es>",
6
6
  "scripts": {
@@ -594,6 +594,11 @@ export default class PrefViewer3D extends HTMLElement {
594
594
 
595
595
  const loadDetail = await this.#babylonJSController.load(forceReload);
596
596
 
597
+ // Apply initial render settings if provided in options
598
+ if (config.options?.render) {
599
+ await this.applyRenderSettings(config.options.render);
600
+ }
601
+
597
602
  return { ...loadDetail, load: this.#onLoaded() };
598
603
  }
599
604
 
@@ -622,6 +627,12 @@ export default class PrefViewer3D extends HTMLElement {
622
627
  if (needUpdateIBL) {
623
628
  someSetted = someSetted || (await this.#babylonJSController.setIBLOptions());
624
629
  }
630
+
631
+ // Apply render settings if provided
632
+ if (options.render) {
633
+ await this.applyRenderSettings(options.render);
634
+ }
635
+
625
636
  const detail = this.#onSetOptions();
626
637
  return { success: someSetted, detail: detail };
627
638
  }
@@ -106,7 +106,7 @@ export default class PrefViewer extends HTMLElement {
106
106
  * @returns {string[]} Array of attribute names to observe.
107
107
  */
108
108
  static get observedAttributes() {
109
- return ["config", "culture", "drawing", "materials", "mode", "model", "scene", "options", "show-model", "show-scene"];
109
+ return ["config", "culture", "drawing", "materials", "mode", "model", "scene", "options", "show-model", "show-scene", "show-menu"];
110
110
  }
111
111
 
112
112
  /**
@@ -174,6 +174,10 @@ export default class PrefViewer extends HTMLElement {
174
174
  const showScene = value.toLowerCase() === "true";
175
175
  showScene ? this.showScene() : this.hideScene();
176
176
  break;
177
+ case "show-menu":
178
+ // Recreate menu to apply show/hide setting
179
+ this.#createMenu3D();
180
+ break;
177
181
  }
178
182
  }
179
183
 
@@ -271,6 +275,7 @@ export default class PrefViewer extends HTMLElement {
271
275
  /**
272
276
  * Creates (or recreates) the PrefViewerMenu3D element, wires hover/apply handlers, and syncs it with the 3D component.
273
277
  * When a menu already exists it is removed so the DOM stays clean.
278
+ * Respects the "show-menu" attribute to determine if menu should be visible.
274
279
  * @private
275
280
  * @returns {void}
276
281
  */
@@ -282,6 +287,16 @@ export default class PrefViewer extends HTMLElement {
282
287
  this.#menu3D.removeEventListener("pref-viewer-menu-3d-apply", this.#handlers.onMenuApply);
283
288
  this.#menu3D.remove();
284
289
  }
290
+
291
+ // Check if menu should be shown (default: true if not specified)
292
+ const showMenuAttr = this.getAttribute("show-menu");
293
+ const showMenu = showMenuAttr === null || showMenuAttr === "true";
294
+
295
+ if (!showMenu) {
296
+ this.#menu3D = null;
297
+ return;
298
+ }
299
+
285
300
  this.#menu3D = document.createElement("pref-viewer-menu-3d");
286
301
  if (typeof this.#menu3D.setCulture === "function") {
287
302
  this.#menu3D.setCulture(this.#culture);