senangwebs-tour 1.0.9 → 1.0.11

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": "senangwebs-tour",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "type": "module",
5
5
  "description": "VR 360° virtual tour system with visual editor and viewer library",
6
6
  "main": "dist/swt.js",
@@ -13,6 +13,7 @@ import PreviewController from './js/preview-controller.js';
13
13
  import UIController from './js/ui-controller.js';
14
14
  import ExportManager from './js/export-manager.js';
15
15
  import TourEditor from './js/editor.js';
16
+ import EditorEvents from './js/event-emitter.js';
16
17
 
17
18
  // Attach classes to window for global access
18
19
  window.ProjectStorageManager = ProjectStorageManager;
@@ -22,6 +23,7 @@ window.PreviewController = PreviewController;
22
23
  window.UIController = UIController;
23
24
  window.ExportManager = ExportManager;
24
25
  window.TourEditor = TourEditor;
26
+ window.EditorEvents = EditorEvents;
25
27
 
26
28
  // Import and execute UI initialization
27
29
  import './js/ui-init.js';
@@ -257,6 +257,7 @@ class TourEditor {
257
257
  document.getElementById('tourTitle')?.addEventListener('input', debounce((e) => {
258
258
  this.config.title = e.target.value;
259
259
  this.markUnsavedChanges();
260
+ this.emit(EditorEvents.TOUR_TITLE_CHANGE, { title: e.target.value });
260
261
  const projectName = document.getElementById('project-name');
261
262
  if (projectName && projectName.value !== e.target.value) {
262
263
  projectName.value = e.target.value;
@@ -266,6 +267,7 @@ class TourEditor {
266
267
  document.getElementById('project-name')?.addEventListener('input', debounce((e) => {
267
268
  this.config.title = e.target.value;
268
269
  this.markUnsavedChanges();
270
+ this.emit(EditorEvents.TOUR_TITLE_CHANGE, { title: e.target.value });
269
271
  const tourTitle = document.getElementById('tourTitle');
270
272
  if (tourTitle && tourTitle.value !== e.target.value) {
271
273
  tourTitle.value = e.target.value;
@@ -275,11 +277,13 @@ class TourEditor {
275
277
  document.getElementById('tourDescription')?.addEventListener('input', debounce((e) => {
276
278
  this.config.description = e.target.value;
277
279
  this.markUnsavedChanges();
280
+ this.emit(EditorEvents.TOUR_DESCRIPTION_CHANGE, { description: e.target.value });
278
281
  }, 300));
279
282
 
280
283
  document.getElementById('tourInitialScene')?.addEventListener('change', (e) => {
281
284
  this.config.initialSceneId = e.target.value;
282
285
  this.markUnsavedChanges();
286
+ this.emit(EditorEvents.INITIAL_SCENE_CHANGE, { initialSceneId: e.target.value });
283
287
  });
284
288
 
285
289
  document.getElementById('exportJsonBtn')?.addEventListener('click', () => {
@@ -43,9 +43,11 @@ export const EditorEvents = {
43
43
  PROJECT_IMPORT: 'project:import',
44
44
  PROJECT_EXPORT: 'project:export',
45
45
 
46
- // Config events
46
+ // Config/Tour events
47
47
  CONFIG_UPDATE: 'config:update',
48
48
  INITIAL_SCENE_CHANGE: 'config:initialSceneChange',
49
+ TOUR_TITLE_CHANGE: 'tour:titleChange',
50
+ TOUR_DESCRIPTION_CHANGE: 'tour:descriptionChange',
49
51
 
50
52
  // Preview events
51
53
  PREVIEW_START: 'preview:start',
@@ -207,6 +209,7 @@ class EventEmitter {
207
209
  const dataEvents = [
208
210
  EditorEvents.SCENE_ADD,
209
211
  EditorEvents.SCENE_REMOVE,
212
+ EditorEvents.SCENE_SELECT,
210
213
  EditorEvents.SCENE_UPDATE,
211
214
  EditorEvents.SCENE_REORDER,
212
215
  EditorEvents.SCENE_CLEAR,
@@ -215,11 +218,14 @@ class EventEmitter {
215
218
  EditorEvents.SCENE_STARTING_POSITION_CLEAR,
216
219
  EditorEvents.HOTSPOT_ADD,
217
220
  EditorEvents.HOTSPOT_REMOVE,
221
+ EditorEvents.HOTSPOT_SELECT,
218
222
  EditorEvents.HOTSPOT_UPDATE,
219
223
  EditorEvents.HOTSPOT_DUPLICATE,
220
224
  EditorEvents.HOTSPOT_POSITION_CHANGE,
221
225
  EditorEvents.CONFIG_UPDATE,
222
226
  EditorEvents.INITIAL_SCENE_CHANGE,
227
+ EditorEvents.TOUR_TITLE_CHANGE,
228
+ EditorEvents.TOUR_DESCRIPTION_CHANGE,
223
229
  EditorEvents.PROJECT_LOAD,
224
230
  EditorEvents.PROJECT_IMPORT,
225
231
  EditorEvents.PROJECT_NEW,
package/src/index.js CHANGED
@@ -80,7 +80,8 @@ class Tour {
80
80
  * @returns {Object|undefined} - Scene data or undefined if not found
81
81
  */
82
82
  getSceneById(sceneId) {
83
- return this.scenesArray.find((scene) => scene.id === sceneId);
83
+ const targetId = String(sceneId);
84
+ return this.scenesArray.find((scene) => String(scene.id) === targetId);
84
85
  }
85
86
 
86
87
  /**
@@ -92,8 +93,7 @@ class Tour {
92
93
  let cursor = camera.querySelector("[cursor]");
93
94
  if (!cursor) {
94
95
  cursor = document.createElement("a-cursor");
95
- cursor.setAttribute("fuse", "true");
96
- cursor.setAttribute("fuse-timeout", "1500");
96
+ cursor.setAttribute("fuse", "false");
97
97
  camera.appendChild(cursor);
98
98
  }
99
99
  }