Browse Source

Add API method to get current scene ID.

pull/124/head
Matthew Petroff 8 years ago
parent
commit
0d286fea43
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      src/js/pannellum.js

+ 13
- 0
src/js/pannellum.js View File

@@ -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 {


Loading…
Cancel
Save