Browse Source

Bugfix

Signed-off-by: Matthew Petroff <matthew@mpetroff.net>
pull/5/head
András Molnár 11 years ago
committed by Matthew Petroff
parent
commit
38e83d17b7
1 changed files with 24 additions and 5 deletions
  1. +24
    -5
      src/js/pannellum.js

+ 24
- 5
src/js/pannellum.js View File

@@ -399,6 +399,10 @@ function renderInit() {
}

function createHotSpots() {
//Fix if there are no hotspots
if(!config.hotSpots){
config.hotSpots = [];
}
config.hotSpots.forEach(function(hs) {
var div = document.createElement('div');
var span = document.createElement('span');
@@ -415,7 +419,7 @@ function createHotSpots() {
a.setAttribute('href', 'javascript:void(0);');
//a.setAttribute('onClick', 'loadScene(' + hs.sceneId + '); return false;');
a.onclick = function(){
var id = sceneId;
var id = hs.sceneId;
loadScene(id);
return false;
};
@@ -435,6 +439,18 @@ function createHotSpots() {
});
}

function destroyHotSpots() {
if(config.hotSpots){
config.hotSpots.forEach(function(hs) {
var current = hs.div;
while(current.parentNode.id != 'page'){
current = current.parentNode;
}
document.getElementById('page').removeChild(current);
});
}
}

function renderHotSpots() {
config.hotSpots.forEach(function(hs) {
var z = Math.sin(hs.pitch * Math.PI / 180) * Math.sin(pitch * Math.PI /
@@ -515,8 +531,6 @@ function parseURLParameters() {
}else{
loadSceneData(null);
}
//TODO: URL-bõl jövõ cuccokat külön változóba
//load: config=urlbackup, merge global, merge scene
}
}
}
@@ -526,13 +540,14 @@ function loadSceneData(sceneId){
config = tour.configFromUrl;
// Merge global options
for(var k in tour.global){
config[k] = c[k];
config[k] = tour.global[k];
}
// Merge scene options
if((sceneId != null) && (sceneId != '') && (tour.scenes) && (tour.scenes[sceneId]))
{
for(var k in tour.scenes[sceneId]){
config[k] = c[k];
var scene = tour.scenes[sceneId];
config[k] = scene[k];
}
config.activeScene = sceneId;
}
@@ -736,7 +751,11 @@ function load() {

function loadScene(sceneId){
loaded = false;
// Destroy hotspots from previous scene
destroyHotSpots();
// Create the new config for the scene
loadSceneData(sceneId);
// Reload scene
processOptions();
load();
}

Loading…
Cancel
Save