aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/views/base.js3
-rwxr-xr-xjs/document/views/design.js29
2 files changed, 28 insertions, 4 deletions
diff --git a/js/document/views/base.js b/js/document/views/base.js
index e771702d..18676d1f 100755
--- a/js/document/views/base.js
+++ b/js/document/views/base.js
@@ -64,6 +64,7 @@ exports.BaseDocumentView = Montage.create(Component, {
64 if (this.iframe) { 64 if (this.iframe) {
65 this.iframe.style.display = 'block'; 65 this.iframe.style.display = 'block';
66 this.iframe.style.opacity = 1; 66 this.iframe.style.opacity = 1;
67 this.toggleWebGlAnimation(true);
67 } else { 68 } else {
68 console.log('Error: View has no iframe to show!'); 69 console.log('Error: View has no iframe to show!');
69 } 70 }
@@ -78,6 +79,8 @@ exports.BaseDocumentView = Montage.create(Component, {
78 if (this.iframe) { 79 if (this.iframe) {
79 this.iframe.style.display = 'none'; 80 this.iframe.style.display = 'none';
80 this.iframe.style.opacity = 0; 81 this.iframe.style.opacity = 0;
82 this.pauseVideos();
83 this.toggleWebGlAnimation(false);
81 } else { 84 } else {
82 console.log('Error: View has no iframe to hide!'); 85 console.log('Error: View has no iframe to hide!');
83 } 86 }
diff --git a/js/document/views/design.js b/js/document/views/design.js
index 44ed2c65..ed98b660 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -537,9 +537,11 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
537 // 537 //
538 pauseVideos:{ 538 pauseVideos:{
539 value:function(){ 539 value:function(){
540 var i, videos = this.document.getElementsByTagName("video"); 540 if(this.document) {
541 for(i = 0; i < videos.length; i++){ 541 var i, videos = this.document.getElementsByTagName("video");
542 if(!videos[i].paused) videos[i].pause(); 542 for(i = 0; i < videos.length; i++){
543 if(!videos[i].paused) videos[i].pause();
544 }
543 } 545 }
544 } 546 }
545 }, 547 },
@@ -563,9 +565,28 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
563 videos[i].src = ""; 565 videos[i].src = "";
564 } 566 }
565 } 567 }
566 } 568 },
567 //////////////////////////////////////////////////////////////////// 569 ////////////////////////////////////////////////////////////////////
568 //////////////////////////////////////////////////////////////////// 570 ////////////////////////////////////////////////////////////////////
571 toggleWebGlAnimation: {
572 value: function(show) {
573 if(this.document) {
574 var glCanvases = this.document.querySelectorAll('[data-RDGE-id]'),
575 glShapeModel;
576 if(glCanvases) {
577 for(var i = 0, len = glCanvases.length; i<len; i++) {
578 glShapeModel = glCanvases[i].elementModel.shapeModel;
579 if(show) {
580 glShapeModel.GLWorld.restartRenderLoop();
581 } else {
582 glShapeModel.GLWorld.stop();
583 }
584 }
585
586 }
587 }
588 }
589 }
569}); 590});
570//////////////////////////////////////////////////////////////////////// 591////////////////////////////////////////////////////////////////////////
571//////////////////////////////////////////////////////////////////////// 592////////////////////////////////////////////////////////////////////////