Browse Source

Missing cubemap faces now need to be defined as null in the configuration

pull/570/head
David von Oheimb 6 years ago
parent
commit
70dcb087ae
2 changed files with 11 additions and 12 deletions
  1. +1
    -2
      doc/json-config-parameters.md
  2. +10
    -10
      src/js/pannellum.js

+ 1
- 2
doc/json-config-parameters.md View File

@@ -361,8 +361,7 @@ said data will override any existing settings. Defaults to `false`.
This is an array of URLs for the six cube faces in the order front, right, This is an array of URLs for the six cube faces in the order front, right,
back, left, up, down. These are relative to `basePath` if it is set, else they back, left, up, down. These are relative to `basePath` if it is set, else they
are relative to the location of `pannellum.htm`. Absolute URLs can also be are relative to the location of `pannellum.htm`. Absolute URLs can also be
used.

used. Partial cubemap images may be specified by giving `null` instead of a URL.




## `multires` specific options ## `multires` specific options


+ 10
- 10
src/js/pannellum.js View File

@@ -350,11 +350,6 @@ function init() {
}; };
var onError = function(e) { var onError = function(e) {
if (1) { // support partial cubemap image, i.e., missing faces
console.log(config.strings.fileAccessError.replace('%s', e.target.src)+'; will use background instead');
onLoad();
return;
}
var a = document.createElement('a'); var a = document.createElement('a');
a.href = e.target.src; a.href = e.target.src;
a.innerHTML = a.href; a.innerHTML = a.href;
@@ -362,13 +357,18 @@ function init() {
}; };
for (i = 0; i < panoImage.length; i++) { for (i = 0; i < panoImage.length; i++) {
panoImage[i].onload = onLoad;
panoImage[i].onerror = onError;
p = config.cubeMap[i]; p = config.cubeMap[i];
if (config.basePath && !absoluteURL(p)) {
p = config.basePath + p;
if (p == "null") { // support partial cubemap image with explicitly empty faces
console.log('Will use background instead of missing cubemap face ' + i);
onLoad();
} else {
if (config.basePath && !absoluteURL(p)) {
p = config.basePath + p;
}
panoImage[i].onload = onLoad;
panoImage[i].onerror = onError;
panoImage[i].src = encodeURI(p);
} }
panoImage[i].src = encodeURI(p);
} }
} else if (config.type == 'multires') { } else if (config.type == 'multires') {
onImageLoad(); onImageLoad();


Loading…
Cancel
Save