From f32badcd0a749b84a3147f8632523df5a4431fc9 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Tue, 26 Jan 2016 16:47:46 -0500 Subject: [PATCH] Only use multires zoom calculation to increase zoom (not decrease it) and handle case where minimum HFOV is greater than maximum HFOV (fixes #107). --- src/js/pannellum.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index 6c28ff6..da4143d 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -1575,12 +1575,15 @@ function zoomOut() { */ function setHfov(hfov) { // Keep field of view within bounds - if (hfov < config.minHfov && config.type != 'multires') { - config.hfov = config.minHfov; - } else if (config.type == 'multires' && renderer && hfov < renderer.getCanvas().width / - (config.multiRes.cubeResolution / 90 * 0.9)) { - - config.hfov = renderer.getCanvas().width / (config.multiRes.cubeResolution / 90 * 0.9); + var minHfov = config.minHfov; + if (config.type == 'multires' && renderer) { + minHfov = Math.min(minHfov, renderer.getCanvas().width / (config.multiRes.cubeResolution / 90 * 0.9)); + } + if (minHfov >= config.maxHfov) { + // Don't change view if bounds don't make sense + return; + } if (hfov < minHfov) { + config.hfov = minHfov; } else if (hfov > config.maxHfov) { config.hfov = config.maxHfov; } else {