Przeglądaj źródła

Make hot spot and scene ID checking less strict (#1088).

pull/1121/head
Matthew Petroff 2 lat temu
rodzic
commit
71bac61e3b
2 zmienionych plików z 4 dodań i 4 usunięć
  1. +1
    -1
      doc/json-config-parameters.md
  2. +3
    -3
      src/js/pannellum.js

+ 1
- 1
doc/json-config-parameters.md Wyświetl plik

@@ -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.



+ 3
- 3
src/js/pannellum.js Wyświetl plik

@@ -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;


Ładowanie…
Anuluj
Zapisz