From 28144ad30191575c6e1269f9c2bebb144738b7a4 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Wed, 15 Apr 2020 13:23:44 -0400 Subject: [PATCH 1/2] Fix issue with `avoidShowingBackground` without `minPitch` / `maxPitch` defined (fixes #851). --- doc/json-config-parameters.md | 3 ++- src/js/pannellum.js | 2 +- utils/multires/generate.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/json-config-parameters.md b/doc/json-config-parameters.md index e32ef7a..0ab150f 100644 --- a/doc/json-config-parameters.md +++ b/doc/json-config-parameters.md @@ -361,7 +361,8 @@ by constraining the yaw and the field-of-view. Even at the corners and edges of the canvas only areas actually belonging to the image (i.e., within [`minYaw`, `maxYaw`] and [`minPitch`, `maxPitch`]) are shown, thus setting the `backgroundColor` option is not needed if this option is set. -Defaults to `false`. +Defaults to `false`. The `minPitch` and `maxPitch` parameters must be defined +if this option is enabled. ## `equirectangular` specific options diff --git a/src/js/pannellum.js b/src/js/pannellum.js index 8f61ba5..7c300c3 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -2231,7 +2231,7 @@ function constrainHfov(hfov) { newHfov = hfov; } // Optionally avoid showing background (empty space) on top or bottom by adapting newHfov - if (config.avoidShowingBackground && renderer) { + if (config.avoidShowingBackground && renderer && !isNaN(config.maxPitch - config.minPitch)) { var canvas = renderer.getCanvas(); newHfov = Math.min(newHfov, Math.atan(Math.tan((config.maxPitch - config.minPitch) / 360 * Math.PI) / diff --git a/utils/multires/generate.py b/utils/multires/generate.py index 38d6d52..d72ab5e 100755 --- a/utils/multires/generate.py +++ b/utils/multires/generate.py @@ -5,7 +5,7 @@ # generate.py - A multires tile set generator for Pannellum # Extensions to cylindrical input and partial panoramas by David von Oheimb -# Copyright (c) 2014-2018 Matthew Petroff +# Copyright (c) 2014-2020 Matthew Petroff # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -246,7 +246,7 @@ if vaov < 180: text.append(' "maxPitch": ' + str(+vaov/2+args.vOffset)+ ',') if colorTuple != (0, 0, 0): text.append(' "backgroundColor": "' + args.backgroundColor+ '",') -if args.avoidbackground: +if args.avoidbackground and (haov < 360 or vaov < 180): text.append(' "avoidShowingBackground": true,') if args.autoload: text.append(' "autoLoad": true,') From 6075769935a27e61c9e1f0f656f8cef532abaa77 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Fri, 8 May 2020 11:14:51 -0400 Subject: [PATCH 2/2] Trigger click handler functions with touch input (fixes #861). --- src/js/pannellum.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index 7c300c3..c7297f4 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -1800,6 +1800,16 @@ function createHotSpot(hs) { div.addEventListener('click', function(e) { hs.clickHandlerFunc(e, hs.clickHandlerArgs); }, 'false'); + if (document.documentElement.style.pointerAction === '' && + document.documentElement.style.touchAction === '') { + div.addEventListener('pointerup', function(e) { + hs.clickHandlerFunc(e, hs.clickHandlerArgs); + }, false); + } else { + div.addEventListener('touchend', function(e) { + hs.clickHandlerFunc(e, hs.clickHandlerArgs); + }, false); + } div.className += ' pnlm-pointer'; span.className += ' pnlm-pointer'; }