diff options
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/views/base.js | 3 | ||||
-rwxr-xr-x | js/document/views/design.js | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/js/document/views/base.js b/js/document/views/base.js index 89baa871..14ee8e6c 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 448ff9e9..c7f57e58 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js | |||
@@ -537,11 +537,13 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
537 | // | 537 | // |
538 | pauseVideos:{ | 538 | pauseVideos:{ |
539 | value:function(){ | 539 | value:function(){ |
540 | if(this.document) { | ||
540 | var i, videos = this.document.getElementsByTagName("video"); | 541 | var i, videos = this.document.getElementsByTagName("video"); |
541 | for(i = 0; i < videos.length; i++){ | 542 | for(i = 0; i < videos.length; i++){ |
542 | if(!videos[i].paused) videos[i].pause(); | 543 | if(!videos[i].paused) videos[i].pause(); |
543 | } | 544 | } |
544 | } | 545 | } |
546 | } | ||
545 | }, | 547 | }, |
546 | //////////////////////////////////////////////////////////////////// | 548 | //////////////////////////////////////////////////////////////////// |
547 | // | 549 | // |
@@ -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 | //////////////////////////////////////////////////////////////////////// |