diff options
Diffstat (limited to 'js/document/views')
-rwxr-xr-x | js/document/views/base.js | 3 | ||||
-rwxr-xr-x | js/document/views/design.js | 29 |
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 6a60e1f9..5c7ba4fc 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js | |||
@@ -497,9 +497,11 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
497 | // | 497 | // |
498 | pauseVideos:{ | 498 | pauseVideos:{ |
499 | value:function(){ | 499 | value:function(){ |
500 | var i, videos = this.document.getElementsByTagName("video"); | 500 | if(this.document) { |
501 | for(i = 0; i < videos.length; i++){ | 501 | var i, videos = this.document.getElementsByTagName("video"); |
502 | if(!videos[i].paused) videos[i].pause(); | 502 | for(i = 0; i < videos.length; i++){ |
503 | if(!videos[i].paused) videos[i].pause(); | ||
504 | } | ||
503 | } | 505 | } |
504 | } | 506 | } |
505 | }, | 507 | }, |
@@ -523,9 +525,28 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
523 | videos[i].src = ""; | 525 | videos[i].src = ""; |
524 | } | 526 | } |
525 | } | 527 | } |
526 | } | 528 | }, |
527 | //////////////////////////////////////////////////////////////////// | 529 | //////////////////////////////////////////////////////////////////// |
528 | //////////////////////////////////////////////////////////////////// | 530 | //////////////////////////////////////////////////////////////////// |
531 | toggleWebGlAnimation: { | ||
532 | value: function(show) { | ||
533 | if(this.document) { | ||
534 | var glCanvases = this.document.querySelectorAll('[data-RDGE-id]'), | ||
535 | glShapeModel; | ||
536 | if(glCanvases) { | ||
537 | for(var i = 0, len = glCanvases.length; i<len; i++) { | ||
538 | glShapeModel = glCanvases[i].elementModel.shapeModel; | ||
539 | if(show) { | ||
540 | glShapeModel.GLWorld.restartRenderLoop(); | ||
541 | } else { | ||
542 | glShapeModel.GLWorld.stop(); | ||
543 | } | ||
544 | } | ||
545 | |||
546 | } | ||
547 | } | ||
548 | } | ||
549 | } | ||
529 | }); | 550 | }); |
530 | //////////////////////////////////////////////////////////////////////// | 551 | //////////////////////////////////////////////////////////////////////// |
531 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file | 552 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file |