senangwebs-tour 1.0.7 → 1.0.8
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
package/src/editor/js/editor.js
CHANGED
|
@@ -55,8 +55,8 @@ class TourEditor {
|
|
|
55
55
|
// Setup event listeners
|
|
56
56
|
this.setupEventListeners();
|
|
57
57
|
|
|
58
|
-
// Populate icon grid
|
|
59
|
-
this.uiController.populateIconGrid();
|
|
58
|
+
// Populate icon grid (async to wait for custom element registration)
|
|
59
|
+
await this.uiController.populateIconGrid();
|
|
60
60
|
|
|
61
61
|
// Load saved project if exists (but only if it has valid data)
|
|
62
62
|
if (this.storageManager.hasProject()) {
|
|
@@ -570,6 +570,7 @@ class TourEditor {
|
|
|
570
570
|
render() {
|
|
571
571
|
this.uiController.renderSceneList();
|
|
572
572
|
this.uiController.renderHotspotList();
|
|
573
|
+
this.uiController.populateIconGrid(); // Re-render icon grid to ensure icons display
|
|
573
574
|
|
|
574
575
|
const currentScene = this.sceneManager.getCurrentScene();
|
|
575
576
|
const currentHotspot = this.hotspotEditor.getCurrentHotspot();
|
|
@@ -281,11 +281,27 @@ class UIController {
|
|
|
281
281
|
|
|
282
282
|
/**
|
|
283
283
|
* Populate icon grid from SenangStart icons (baked in at build time)
|
|
284
|
+
* Waits for ss-icon custom element to be defined to avoid race conditions
|
|
284
285
|
*/
|
|
285
|
-
populateIconGrid() {
|
|
286
|
+
async populateIconGrid() {
|
|
286
287
|
const grid = document.getElementById("hotspotIconGrid");
|
|
287
288
|
if (!grid) return;
|
|
288
289
|
|
|
290
|
+
// Wait for ss-icon custom element to be defined before populating
|
|
291
|
+
// This prevents race conditions where icons don't render if the
|
|
292
|
+
// custom element isn't registered yet when this method runs
|
|
293
|
+
try {
|
|
294
|
+
if (customElements.get('ss-icon') === undefined) {
|
|
295
|
+
// Give a reasonable timeout to avoid infinite waiting
|
|
296
|
+
await Promise.race([
|
|
297
|
+
customElements.whenDefined('ss-icon'),
|
|
298
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('ss-icon timeout')), 5000))
|
|
299
|
+
]);
|
|
300
|
+
}
|
|
301
|
+
} catch (err) {
|
|
302
|
+
console.warn('ss-icon custom element not available, icon grid may not render properly:', err.message);
|
|
303
|
+
}
|
|
304
|
+
|
|
289
305
|
// Clear existing content
|
|
290
306
|
grid.innerHTML = "";
|
|
291
307
|
|