aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnanya Sen2012-03-07 14:26:37 -0800
committerAnanya Sen2012-03-07 14:26:37 -0800
commit250420d8c6154172b27fe53aff30e78c227e8a67 (patch)
treef4cad44f6145ad9f0fdba2667f04df166f9f1f37
parent8020dc6e99e3bf0aad605f66a175bc2245da534b (diff)
downloadninja-250420d8c6154172b27fe53aff30e78c227e8a67.tar.gz
minor fixes
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rwxr-xr-xjs/controllers/document-controller.js12
-rwxr-xr-xjs/controllers/selection-controller.js14
-rwxr-xr-xjs/document/html-document.js25
-rwxr-xr-xjs/stage/layout.js4
4 files changed, 22 insertions, 33 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index ca3cd585..87e93465 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -166,7 +166,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
166 //////////////////////////////////////////////////////////////////// 166 ////////////////////////////////////////////////////////////////////
167 handleExecuteFileClose:{ 167 handleExecuteFileClose:{
168 value: function(event) { 168 value: function(event) {
169 if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ 169 if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){
170 this.closeDocument(this.activeDocument.uuid); 170 this.closeDocument(this.activeDocument.uuid);
171 } 171 }
172 } 172 }
@@ -372,11 +372,11 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
372 nextDocumentIndex = closeDocumentIndex - 1; 372 nextDocumentIndex = closeDocumentIndex - 1;
373 } 373 }
374 this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); 374 this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]);
375 doc.stopVideos(); 375 if(typeof this.activeDocument.stopVideos !== "undefined"){doc.stopVideos();}
376 this._removeDocumentView(doc.container); 376 this._removeDocumentView(doc.container);
377 }else if(this._documents.length === 0){ 377 }else if(this._documents.length === 0){
378 if(typeof this.activeDocument.pauseVideos !== "undefined"){ 378 if(typeof this.activeDocument.pauseAndStopVideos !== "undefined"){
379 this.activeDocument.pauseVideos(true); 379 this.activeDocument.pauseAndStopVideos();
380 } 380 }
381 this.activeDocument = null; 381 this.activeDocument = null;
382 this._removeDocumentView(doc.container); 382 this._removeDocumentView(doc.container);
@@ -385,8 +385,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
385 385
386 this.application.ninja.stage.hideCanvas(true); 386 this.application.ninja.stage.hideCanvas(true);
387 }else{//closing inactive document tab - just clear DOM 387 }else{//closing inactive document tab - just clear DOM
388 if(typeof doc.pauseVideos !== "undefined"){ 388 if(typeof doc.pauseAndStopVideos !== "undefined"){
389 doc.pauseVideos(true); 389 doc.pauseAndStopVideos();
390 } 390 }
391 this._removeDocumentView(doc.container); 391 this._removeDocumentView(doc.container);
392 } 392 }
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index eff9c91a..c713b6e5 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -100,20 +100,6 @@ exports.SelectionController = Montage.create(Component, {
100 this._isDocument = false; 100 this._isDocument = false;
101 } 101 }
102 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); 102 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
103
104 this._selectionContainer = this.application.ninja.currentSelectedContainer;
105 }
106 }
107 },
108
109 handleCloseDocument:{
110 value: function() {
111 //clear selections if all documents are closed
112 if(this.application.ninja.documentController._documents.length === 0){
113 this._selectedItems.length =0;
114 this.application.ninja.selectedElements.length =0;
115 this._isDocument = true;
116 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
117 } 103 }
118 } 104 }
119 }, 105 },
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 83f91c19..f730b853 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -872,22 +872,15 @@ exports.HTMLDocument = Montage.create(TextDocument, {
872 }, 872 },
873 //////////////////////////////////////////////////////////////////// 873 ////////////////////////////////////////////////////////////////////
874 /** 874 /**
875 *pause videos on switching or closing the document, so that the browser does not keep downloading the media data 875 *pause videos on switching or closing the document
876 *removeSrc : boolean to remove the src if the video... set only in the close document flow
877 */ 876 */
878 pauseVideos:{ 877 pauseVideos:{
879 value:function(removeSrc){ 878 value:function(){
880 //console.log("$$$ pauseVideos");
881 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; 879 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0;
882 for(i=0;i<videosArr.length;i++){ 880 for(i=0;i<videosArr.length;i++){
883 if(!videosArr[i].paused){ 881 if(!videosArr[i].paused){
884 videosArr[i].pause(); 882 videosArr[i].pause();
885 } 883 }
886 //console.log("$$$ Paused ", videosArr[i]);
887 if((typeof removeSrc !== "undefined") && (removeSrc === true)){
888 videosArr[i].src = "";
889 //console.log("$$$ stopped ");
890 }
891 } 884 }
892 } 885 }
893 }, 886 },
@@ -897,11 +890,21 @@ exports.HTMLDocument = Montage.create(TextDocument, {
897 */ 890 */
898 stopVideos:{ 891 stopVideos:{
899 value:function(){ 892 value:function(){
900 //console.log("$$$ stopVideos");
901 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; 893 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0;
902 for(i=0;i<videosArr.length;i++){ 894 for(i=0;i<videosArr.length;i++){
903 videosArr[i].src = ""; 895 videosArr[i].src = "";
904 //console.log("$$$ stopped ", videosArr[i]); 896 }
897 }
898 },
899
900 pauseAndStopVideos:{
901 value:function(){
902 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0;
903 for(i=0;i<videosArr.length;i++){
904 if(!videosArr[i].paused){
905 videosArr[i].pause();
906 }
907 videosArr[i].src = "";
905 } 908 }
906 } 909 }
907 } 910 }
diff --git a/js/stage/layout.js b/js/stage/layout.js
index ab2daf9b..8a53a08b 100755
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -65,7 +65,7 @@ exports.Layout = Montage.create(Component, {
65 handleOpenDocument: { 65 handleOpenDocument: {
66 value: function() { 66 value: function() {
67 // Initial elements to draw is the entire node list 67 // Initial elements to draw is the entire node list
68 if(typeof this.application.ninja.documentController.activeDocument._liveNodeList !== "undefined"){//only for designer view 68 if(this.application.ninja.documentController.activeDocument.currentView === "design"){//only for designer view
69 this.elementsToDraw = this.application.ninja.documentController.activeDocument._liveNodeList; 69 this.elementsToDraw = this.application.ninja.documentController.activeDocument._liveNodeList;
70 } 70 }
71 // Draw the elements and the 3d info 71 // Draw the elements and the 3d info
@@ -105,7 +105,7 @@ exports.Layout = Montage.create(Component, {
105 } 105 }
106 106
107 // Make an array copy of the line node list which is not an array like object 107 // Make an array copy of the line node list which is not an array like object
108 if(typeof this.application.ninja.documentController.activeDocument._liveNodeList !== "undefined"){//only for designer view 108 if(this.application.ninja.documentController.activeDocument.currentView === "design"){//only for designer view
109 this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0); 109 this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0);
110 } 110 }
111 // Clear the elements to draw 111 // Clear the elements to draw