From 2babe9783e4ddf9a103f9a2c54e841a934b400c1 Mon Sep 17 00:00:00 2001 From: Chase Walden Date: Mon, 6 Aug 2018 23:12:50 -0600 Subject: [PATCH] Changed Math.min to Math.max Using min causes odd errors where you can actually "zoom closer" than your minHfov setting. If the calculation for the multi-res minHfov is smaller than the config.minHfov, then you can zoom closer. This can happen when cubeResolution is very large and canvas.width is very small. In my case, my cuberesolution is 6704 and canvas.width is 1440. My minHfov is 30 but the calculated minHfov is around 21, allowing me to zoom-in more than desired. --- 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 859cdc6..ad77a3d 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -2145,7 +2145,7 @@ function constrainHfov(hfov) { // Keep field of view within bounds var minHfov = config.minHfov; if (config.type == 'multires' && renderer) { - minHfov = Math.min(minHfov, renderer.getCanvas().width / (config.multiRes.cubeResolution / 90 * 0.9)); + minHfov = Math.max(minHfov, renderer.getCanvas().width / (config.multiRes.cubeResolution / 90 * 0.9)); } if (minHfov > config.maxHfov) { // Don't change view if bounds don't make sense