From 0d286fea4307b1758499f58ec1f8e82763b5b91a Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sat, 12 Mar 2016 15:31:12 -0500 Subject: [PATCH] Add API method to get current scene ID. --- src/js/pannellum.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index b4217a3..1b441b3 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -181,9 +181,11 @@ container.appendChild(compass); if (initialConfig.firstScene) { // Activate first scene if specified in URL mergeConfig(initialConfig.firstScene); + config.scene = initialConfig.firstScene; } else if (initialConfig.default && initialConfig.default.firstScene) { // Activate first scene if specified in file mergeConfig(initialConfig.default.firstScene); + config.scene = initialConfig.default.firstScene; } else { mergeConfig(null); } @@ -1604,6 +1606,7 @@ function load() { function loadScene(sceneId, targetPitch, targetYaw, targetHfov) { loaded = false; oldRenderer = renderer; + config.scene = sceneId; // Set up fade if specified var fadeImg, workingPitch, workingYaw, workingHfov; @@ -1869,6 +1872,16 @@ this.loadScene = function(sceneId, pitch, yaw, hfov) { return this; } +/** + * Get ID of current scene. + * @memberof Viewer + * @instance + * @returns {string} ID of current scene + */ +this.getScene = function() { + return config.scene; +} + } return {