From 14208198aa94c25a53aeb603132d02769128c089 Mon Sep 17 00:00:00 2001 From: Andras Elso Date: Mon, 12 Oct 2020 00:45:50 +0200 Subject: [PATCH] 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; } }