Browse Source

Add function to update dynamic content once (#1135).

pull/1140/head
Matthew Petroff 1 year ago
parent
commit
204241e715
1 changed files with 21 additions and 4 deletions
  1. +21
    -4
      src/js/pannellum.js

+ 21
- 4
src/js/pannellum.js View File

@@ -68,6 +68,7 @@ var config,
externalEventListeners = {},
specifiedPhotoSphereExcludes = [],
update = false, // Should we update when still to render dynamic content
updateOnce = false,
eps = 1e-6,
resizeObserver,
hotspotsCreated = false,
@@ -1651,6 +1652,8 @@ function render() {
config.pitch = Math.max(minPitch, Math.min(maxPitch, config.pitch));
renderer.render(config.pitch * Math.PI / 180, config.yaw * Math.PI / 180, config.hfov * Math.PI / 180, {roll: config.roll * Math.PI / 180, dynamic: update});
if (updateOnce)
updateOnce = update = false;
renderHotSpots();
@@ -3054,10 +3057,24 @@ this.getRenderer = function() {
*/
this.setUpdate = function(bool) {
update = bool === true;
if (renderer === undefined)
onImageLoad();
else
animateInit();
if (update) {
if (renderer === undefined)
onImageLoad();
else
animateInit();
}
return this;
};

/**
* Sets update flag for dynamic content for one frame.
* @memberof Viewer
* @instance
* @returns {Viewer} `this`
*/
this.updateOnce = function() {
updateOnce = true;
this.setUpdate(true);
return this;
};



Loading…
Cancel
Save