Kaynağa Gözat

Fix recently introduced bugs.

pull/54/head
Matthew Petroff 9 yıl önce
ebeveyn
işleme
93dcbaef84
3 değiştirilmiş dosya ile 27 ekleme ve 14 silme
  1. +0
    -1
      examples/example-tour.json
  2. +11
    -0
      src/js/libpannellum.js
  3. +16
    -13
      src/js/pannellum.js

+ 0
- 1
examples/example-tour.json Dosyayı Görüntüle

@@ -43,7 +43,6 @@

"pond": {
"title": "Jordan Pond",
"preview": "./examplepano-preview.jpg",
"panorama": "./examplepano.jpg",
"hotSpots": [
{


+ 11
- 0
src/js/libpannellum.js Dosyayı Görüntüle

@@ -292,6 +292,17 @@ function Renderer(container, image, imageType, video) {
callback();
};

this.destroy = function() {
if (this.container !== undefined) {
if (this.canvas !== undefined) {
this.container.removeChild(this.canvas);
}
if (this.world !== undefined) {
this.container.removeChild(this.world);
}
}
};

this.render = function(pitch, yaw, hfov, returnImage) {
var focal, i;


+ 16
- 13
src/js/pannellum.js Dosyayı Görüntüle

@@ -31,6 +31,7 @@ var config,
tourConfig = {},
configFromURL,
renderer,
oldRenderer,
isUserInteracting = false,
latestInteraction = Date.now(),
onPointerDownPointerX = 0,
@@ -800,6 +801,19 @@ function renderInit() {
}

function renderInitCallback() {
if (oldRenderer !== undefined) {
oldRenderer.destroy();
// Fade if specified
if (config.sceneFadeDuration && oldRenderer.fadeImg !== undefined) {
oldRenderer.fadeImg.style.opacity = 0;
// Remove image
setTimeout(function() {
oldRenderer.container.removeChild(oldRenderer.fadeImg);
}, config.sceneFadeDuration);
}
}
requestAnimationFrame(animate);
// Show compass if applicable
@@ -1224,6 +1238,7 @@ function load() {

function loadScene(sceneId, targetPitch, targetYaw) {
loaded = false;
oldRenderer = renderer;
// Set up fade if specified
var fadeImg;
@@ -1236,6 +1251,7 @@ function loadScene(sceneId, targetPitch, targetYaw) {
fadeImg.src = data;
}
document.getElementById('container').appendChild(fadeImg);
oldRenderer.fadeImg = fadeImg;
}
// Set new pointing
@@ -1263,17 +1279,4 @@ function loadScene(sceneId, targetPitch, targetYaw) {
config.yaw = targetYaw;
}
load();
// Fade if specified
if (config.sceneFadeDuration) {
// For some unclear reason, the fade doesn't work without the timeout
setTimeout(function() {
fadeImg.style.opacity = 0;
}, 10);
// Remove image
setTimeout(function() {
document.getElementById('container').removeChild(fadeImg);
}, config.sceneFadeDuration);
}
}

Yükleniyor…
İptal
Kaydet