From 71bac61e3b840061c8f3177230bc70282e0e8a02 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Mon, 11 Apr 2022 19:22:12 -0400 Subject: [PATCH] Make hot spot and scene ID checking less strict (#1088). --- doc/json-config-parameters.md | 2 +- src/js/pannellum.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/json-config-parameters.md b/doc/json-config-parameters.md index a6544bd..ae8b24b 100644 --- a/doc/json-config-parameters.md +++ b/doc/json-config-parameters.md @@ -315,7 +315,7 @@ Specifies the HFOV of the target scene, in degrees. Can also be set to `same`, which uses the current HFOV of the current scene as the initial HFOV of the target scene. -#### `id` +#### `id` (string) Specifies hot spot ID, for use with API's `removeHotSpot` function. diff --git a/src/js/pannellum.js b/src/js/pannellum.js index b80af51..1b49974 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -3117,7 +3117,7 @@ this.addScene = function(sceneId, config) { * @returns {boolean} False if the scene is the current scene or if the scene doesn't exists, else true */ this.removeScene = function(sceneId) { - if (config.scene === sceneId || !initialConfig.scenes.hasOwnProperty(sceneId)) + if (config.scene == sceneId || !initialConfig.scenes.hasOwnProperty(sceneId)) return false; delete initialConfig.scenes[sceneId]; return true; @@ -3204,7 +3204,7 @@ this.removeHotSpot = function(hotSpotId, sceneId) { return false; for (var i = 0; i < config.hotSpots.length; i++) { if (config.hotSpots[i].hasOwnProperty('id') && - config.hotSpots[i].id === hotSpotId) { + config.hotSpots[i].id == hotSpotId) { // Delete hot spot DOM elements var current = config.hotSpots[i].div; while (current.parentNode != uiContainer) @@ -3222,7 +3222,7 @@ this.removeHotSpot = function(hotSpotId, sceneId) { return false; for (var j = 0; j < initialConfig.scenes[sceneId].hotSpots.length; j++) { if (initialConfig.scenes[sceneId].hotSpots[j].hasOwnProperty('id') && - initialConfig.scenes[sceneId].hotSpots[j].id === hotSpotId) { + initialConfig.scenes[sceneId].hotSpots[j].id == hotSpotId) { // Remove hot spot from configuration initialConfig.scenes[sceneId].hotSpots.splice(j, 1); return true;