From c14a95df56099c6121e6905b39023b12a3ddef12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20H=C3=B6llerich?= Date: Mon, 15 Jun 2020 21:41:46 +0200 Subject: [PATCH] Fix tile path generation when no extension is specified. --- src/js/libpannellum.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/js/libpannellum.js b/src/js/libpannellum.js index e187f59..404022d 100644 --- a/src/js/libpannellum.js +++ b/src/js/libpannellum.js @@ -276,7 +276,8 @@ function Renderer(container) { faceImg.onload = onLoad; faceImg.onerror = incLoaded; // ignore missing face to support partial fallback image if (imageType == 'multires') { - faceImg.src = path.replace('%s', sides[s]) + '.' + image.extension; + var extendedPath = image.extension ? path + '.' + image.extension : path; + faceImg.src = extendedPath.replace('%s', sides[s]); } else { faceImg.src = image[s].src; } @@ -1131,7 +1132,8 @@ function Renderer(container) { } else { this.path = path.replace('%s', side).replace('%l', level).replace('%x', x).replace('%y', y); } - this.uri = encodeURI(this.path + '.' + image.extension); + var extendedPath = image.extension ? this.path + '.' + image.extension : this.path; + this.uri = encodeURI(extendedPath); } function getCornerTile(node, dx, dy) { @@ -1940,7 +1942,8 @@ function Renderer(container) { * @param {MultiresNode} node - Input node. */ function processNextTile(node) { - loadTexture(node, image.loader || node.path + '.' + image.extension, function (texture, loaded) { + var extendedPath = image.extension ? node.path + '.' + image.extension : node.path; + loadTexture(node, image.loader || extendedPath, function (texture, loaded) { node.texture = texture; node.textureLoaded = loaded ? 2 : 1;