From 2d529c5fac97f62f511edee44e7a3cbe9a3cafc6 Mon Sep 17 00:00:00 2001 From: Andras Elso Date: Wed, 30 Sep 2020 04:00:55 +0200 Subject: [PATCH 01/11] Dockerfile tweak (#919) * Upgrade dockerfile to ubuntu 20.04 * Delete apt list files --- utils/multires/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/multires/Dockerfile b/utils/multires/Dockerfile index 86a3024..9669c49 100644 --- a/utils/multires/Dockerfile +++ b/utils/multires/Dockerfile @@ -1,11 +1,12 @@ -FROM ubuntu:18.04 +FROM ubuntu:20.04 # docker build -t generate-panorama . # docker run -it -v $PWD:/data generate-panorama /data/image.jpg ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && \ - apt-get install -y python3 python3-dev python3-pil hugin-tools +RUN apt-get update && apt-get install -y --no-install-recommends \ + python3 python3-dev python3-pil hugin-tools \ + && rm -rf /var/lib/apt/lists/* ADD generate.py /generate.py ENTRYPOINT ["python3", "/generate.py"] From 7f2041c9cfd2ff6f79a2f72bbaddca272563ce3b Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sun, 4 Oct 2020 14:14:15 -0400 Subject: [PATCH 02/11] Fix regression in Safari caused by PR #881. --- src/js/pannellum.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index 6bd5f7c..c5890c6 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -381,7 +381,7 @@ function init() { if (config.dynamic !== true) { // Still image if (config.panorama instanceof Image || config.panorama instanceof ImageData || - config.panorama instanceof ImageBitmap) { + (window.ImageBitmap && config.panorama instanceof ImageBitmap)) { panoImage = config.panorama; onImageLoad(); return; From 14208198aa94c25a53aeb603132d02769128c089 Mon Sep 17 00:00:00 2001 From: Andras Elso Date: Mon, 12 Oct 2020 00:45:50 +0200 Subject: [PATCH 03/11] Add support for initial view settings (#918) * Add support for initial view settings * Independent pitch/yap/hfov configure from xmp --- src/js/pannellum.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index c5890c6..190e6ad 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -577,7 +577,10 @@ function parseGPanoXMP(image, url) { topPixels: getTag('GPano:CroppedAreaTopPixels'), heading: getTag('GPano:PoseHeadingDegrees'), horizonPitch: getTag('GPano:PosePitchDegrees'), - horizonRoll: getTag('GPano:PoseRollDegrees') + horizonRoll: getTag('GPano:PoseRollDegrees'), + pitch: getTag('GPano:InitialViewPitchDegrees'), + yaw: getTag('GPano:InitialViewHeadingDegrees'), + hfov: getTag('GPano:InitialHorizontalFOVDegrees') }; if (xmp.fullWidth !== null && xmp.croppedWidth !== null && @@ -605,7 +608,12 @@ function parseGPanoXMP(image, url) { config.horizonRoll = xmp.horizonRoll; } - // TODO: add support for initial view settings + if (xmp.pitch != null && specifiedPhotoSphereExcludes.indexOf('pitch') < 0) + config.pitch = xmp.pitch; + if (xmp.yaw != null && specifiedPhotoSphereExcludes.indexOf('yaw') < 0) + config.yaw = xmp.yaw; + if (xmp.hfov != null && specifiedPhotoSphereExcludes.indexOf('hfov') < 0) + config.hfov = xmp.hfov; } } From 7278d9a3b88cd5ed5a1fdb7bbdba96416be935a5 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sat, 17 Oct 2020 11:34:59 -0400 Subject: [PATCH 04/11] Tweak keyboard pan / zoom speeds. --- src/js/pannellum.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index 190e6ad..f3ba9d6 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -1240,12 +1240,12 @@ function keyRepeat() { if (prevTime === undefined) { prevTime = newTime; } - var diff = (newTime - prevTime) * config.hfov / 1700; - diff = Math.min(diff, 1.0); + var diff = (newTime - prevTime) * config.hfov / 1200; + diff = Math.min(diff, 10.0); // Avoid jump if something goes wrong with time diff // If minus key is down if (keysDown[0] && config.keyboardZoom === true) { - setHfov(config.hfov + (speed.hfov * 0.8 + 0.5) * diff); + setHfov(config.hfov + (speed.hfov * 0.8 + 0.4) * diff); isKeyDown = true; } From 776775f1d821b6b032a4c4175ceff20e21d66f36 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Thu, 22 Oct 2020 10:01:13 -0400 Subject: [PATCH 05/11] Add `rel="noopener"` to `target="_blank"` links to improve security (#929). --- src/js/pannellum.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index f3ba9d6..4d9b02c 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -160,7 +160,7 @@ uiContainer.appendChild(dragFix); // Display about information on right click var aboutMsg = document.createElement('span'); aboutMsg.className = 'pnlm-about-msg'; -aboutMsg.innerHTML = 'Pannellum'; +aboutMsg.innerHTML = 'Pannellum'; uiContainer.appendChild(aboutMsg); dragFix.addEventListener('contextmenu', aboutMessage); @@ -1790,6 +1790,7 @@ function createHotSpot(hs) { a = document.createElement('a'); a.href = sanitizeURL(hs.URL ? hs.URL : imgp, true); a.target = '_blank'; + a.rel = 'noopener'; span.appendChild(a); var image = document.createElement('img'); image.src = sanitizeURL(imgp); @@ -1807,6 +1808,7 @@ function createHotSpot(hs) { } } else { a.target = '_blank'; + a.rel = 'noopener'; } renderContainer.appendChild(a); div.className += ' pnlm-pointer'; @@ -2127,6 +2129,7 @@ function processOptions(isPreview) { var authorLink = document.createElement('a'); authorLink.href = sanitizeURL(config['authorURL'], true); authorLink.target = '_blank'; + authorLink.rel = 'noopener'; authorLink.innerHTML = escapeHTML(config[key]); authorText = authorLink.outerHTML; } @@ -2138,6 +2141,7 @@ function processOptions(isPreview) { var link = document.createElement('a'); link.href = sanitizeURL(config[key], true); link.target = '_blank'; + link.rel = 'noopener'; link.textContent = 'Click here to view this panorama in an alternative viewer.'; var message = document.createElement('p'); message.textContent = 'Your browser does not support WebGL.'; From 4382de1604c2121985ea99bfdc789407bf7735f9 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Thu, 22 Oct 2020 10:29:31 -0400 Subject: [PATCH 06/11] Make opening of links in new tabs configurable. Default to not doing so except for in standalone viewer. --- doc/json-config-parameters.md | 8 ++++++++ src/js/pannellum.js | 33 +++++++++++++++++++++++++-------- src/standalone/standalone.js | 1 + utils/build/build.py | 2 +- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/doc/json-config-parameters.md b/doc/json-config-parameters.md index b4d3ab9..05bf3b7 100644 --- a/doc/json-config-parameters.md +++ b/doc/json-config-parameters.md @@ -234,6 +234,14 @@ the configuration is provided via the URL; it defaults to `false` but can be set to `true` when using the API. +### `targetBlank` (boolean) + +When `true`, `target="_blank"` is set on most hyperlinks to open them in new +tabs. This is always `true` when using the standalone viewer since said viewer +is often used in an `