瀏覽代碼

Stop animate loop running after destroy has been called

pull/779/head
Will Calderbank 5 年之前
committed by Matthew Petroff
父節點
當前提交
447537fbb0
共有 1 個檔案被更改,包括 9 行新增1 行删除
  1. +9
    -1
      src/js/pannellum.js

+ 9
- 1
src/js/pannellum.js 查看文件

@@ -68,7 +68,8 @@ var config,
specifiedPhotoSphereExcludes = [],
update = false, // Should we update when still to render dynamic content
eps = 1e-6,
hotspotsCreated = false;
hotspotsCreated = false,
destroyed = false;

var defaultConfig = {
hfov: 100,
@@ -1357,6 +1358,10 @@ function animateInit() {
* @private
*/
function animate() {
if (destroyed) {
return;
}

render();
if (autoRotateStart)
clearTimeout(autoRotateStart);
@@ -3079,6 +3084,9 @@ function fireEvent(type) {
* @memberof Viewer
*/
this.destroy = function() {
destroyed = true;
clearTimeout(autoRotateStart);

if (renderer)
renderer.destroy();
if (listenersAdded) {


Loading…
取消
儲存