aboutsummaryrefslogtreecommitdiff
path: root/js/document/views
diff options
context:
space:
mode:
Diffstat (limited to 'js/document/views')
-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 d13dce1a..89759195 100755
--- a/js/document/views/base.js
+++ b/js/document/views/base.js
@@ -40,6 +40,7 @@ exports.BaseDocumentView = Montage.create(Component, {
40 if (this.iframe) { 40 if (this.iframe) {
41 this.iframe.style.display = 'block'; 41 this.iframe.style.display = 'block';
42 this.iframe.style.opacity = 1; 42 this.iframe.style.opacity = 1;
43 this.toggleWebGlAnimation(true);
43 } else { 44 } else {
44 console.log('Error: View has no iframe to show!'); 45 console.log('Error: View has no iframe to show!');
45 } 46 }
@@ -54,6 +55,8 @@ exports.BaseDocumentView = Montage.create(Component, {
54 if (this.iframe) { 55 if (this.iframe) {
55 this.iframe.style.display = 'none'; 56 this.iframe.style.display = 'none';
56 this.iframe.style.opacity = 0; 57 this.iframe.style.opacity = 0;
58 this.pauseVideos();
59 this.toggleWebGlAnimation(false);
57 } else { 60 } else {
58 console.log('Error: View has no iframe to hide!'); 61 console.log('Error: View has no iframe to hide!');
59 } 62 }
diff --git a/js/document/views/design.js b/js/document/views/design.js
index b7c50a7c..f8020f2b 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -513,9 +513,11 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
513 // 513 //
514 pauseVideos:{ 514 pauseVideos:{
515 value:function(){ 515 value:function(){
516 var i, videos = this.document.getElementsByTagName("video"); 516 if(this.document) {
517 for(i = 0; i < videos.length; i++){ 517 var i, videos = this.document.getElementsByTagName("video");
518 if(!videos[i].paused) videos[i].pause(); 518 for(i = 0; i < videos.length; i++){
519 if(!videos[i].paused) videos[i].pause();
520 }
519 } 521 }
520 } 522 }
521 }, 523 },
@@ -539,9 +541,28 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
539 videos[i].src = ""; 541 videos[i].src = "";
540 } 542 }
541 } 543 }
542 } 544 },
543 //////////////////////////////////////////////////////////////////// 545 ////////////////////////////////////////////////////////////////////
544 //////////////////////////////////////////////////////////////////// 546 ////////////////////////////////////////////////////////////////////
547 toggleWebGlAnimation: {
548 value: function(show) {
549 if(this.document) {
550 var glCanvases = this.document.querySelectorAll('[data-RDGE-id]'),
551 glShapeModel;
552 if(glCanvases) {
553 for(var i = 0, len = glCanvases.length; i<len; i++) {
554 glShapeModel = glCanvases[i].elementModel.shapeModel;
555 if(show) {
556 glShapeModel.GLWorld.restartRenderLoop();
557 } else {
558 glShapeModel.GLWorld.stop();
559 }
560 }
561
562 }
563 }
564 }
565 }
545}); 566});
546//////////////////////////////////////////////////////////////////////// 567////////////////////////////////////////////////////////////////////////
547//////////////////////////////////////////////////////////////////////// \ No newline at end of file 568//////////////////////////////////////////////////////////////////////// \ No newline at end of file