senangwebs-tour 1.0.6 → 1.0.7

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/dist/swt.js CHANGED
@@ -56521,6 +56521,9 @@ void main() {
56521
56521
  this.config = tourConfig;
56522
56522
  this.isStarted = false;
56523
56523
 
56524
+ // Normalize scenes to array format (backward compatibility with object format)
56525
+ this.scenesArray = this.normalizeScenesArray(tourConfig.scenes);
56526
+
56524
56527
  // Initialize managers
56525
56528
  this.assetManager = new AssetManager(this.sceneEl);
56526
56529
  this.sceneManager = new SceneManager(this.sceneEl, this.assetManager);
@@ -56545,6 +56548,32 @@ void main() {
56545
56548
  this.ensureCursor();
56546
56549
  }
56547
56550
 
56551
+ /**
56552
+ * Normalize scenes to array format
56553
+ * Supports both array and object (keyed by ID) formats for backward compatibility
56554
+ * @param {Array|Object} scenes - Scenes in either format
56555
+ * @returns {Array} - Scenes as array with id property
56556
+ */
56557
+ normalizeScenesArray(scenes) {
56558
+ if (Array.isArray(scenes)) {
56559
+ return scenes;
56560
+ }
56561
+ // Convert object format to array format
56562
+ return Object.entries(scenes).map(([id, sceneData]) => ({
56563
+ id,
56564
+ ...sceneData,
56565
+ }));
56566
+ }
56567
+
56568
+ /**
56569
+ * Get scene data by ID
56570
+ * @param {string} sceneId - The scene ID to find
56571
+ * @returns {Object|undefined} - Scene data or undefined if not found
56572
+ */
56573
+ getSceneById(sceneId) {
56574
+ return this.scenesArray.find((scene) => scene.id === sceneId);
56575
+ }
56576
+
56548
56577
  /**
56549
56578
  * Ensure the scene has a cursor for interaction
56550
56579
  */
@@ -56572,7 +56601,7 @@ void main() {
56572
56601
  }
56573
56602
 
56574
56603
  const initialSceneId = this.config.initialScene;
56575
- const initialSceneData = this.config.scenes[initialSceneId];
56604
+ const initialSceneData = this.getSceneById(initialSceneId);
56576
56605
 
56577
56606
  if (!initialSceneData) {
56578
56607
  throw new Error(
@@ -56614,7 +56643,7 @@ void main() {
56614
56643
  * @returns {Promise}
56615
56644
  */
56616
56645
  async navigateTo(sceneId) {
56617
- const sceneData = this.config.scenes[sceneId];
56646
+ const sceneData = this.getSceneById(sceneId);
56618
56647
 
56619
56648
  if (!sceneData) {
56620
56649
  throw new Error(`Scene "${sceneId}" not found in tour configuration`);