aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/document-controller.js4
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js4
-rwxr-xr-xjs/mediators/keyboard-mediator.js8
-rwxr-xr-xjs/stage/layout.js5
4 files changed, 18 insertions, 3 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 714d1404..02031922 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -338,6 +338,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
338 338
339 this.application.ninja.stage.hideCanvas(true); 339 this.application.ninja.stage.hideCanvas(true);
340 } 340 }
341
342 NJevent("closeDocument", doc.uri);
343
344 doc=null;
341 } 345 }
342 }, 346 },
343 347
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 37fc1cfc..85870097 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -126,8 +126,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
126 this.setWorkingPlane( Vector.create( [0,0,1,0] ) ); 126 this.setWorkingPlane( Vector.create( [0,0,1,0] ) );
127 127
128 //Loop through all the top-level children of the current document and call drawUtils.addElement on them 128 //Loop through all the top-level children of the current document and call drawUtils.addElement on them
129 if(this.application.ninja.currentDocument.documentRoot.hasChildNodes()){ 129 if(this.application.ninja.currentDocument._liveNodeList.length > 0){
130 documentRootChildren = this.application.ninja.currentDocument.documentRoot.childNodes; 130 documentRootChildren = this.application.ninja.currentDocument._liveNodeList;
131 for(i=0;i<documentRootChildren.length;i++){ 131 for(i=0;i<documentRootChildren.length;i++){
132 this.addElement(documentRootChildren[i]); 132 this.addElement(documentRootChildren[i]);
133 } 133 }
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js
index a4bf9baa..f05d3382 100755
--- a/js/mediators/keyboard-mediator.js
+++ b/js/mediators/keyboard-mediator.js
@@ -207,7 +207,13 @@ exports.KeyboardMediator = Montage.create(Component, {
207 207
208 // Check if cmd+s/ctrl+s for Save (Windows/Mac) 208 // Check if cmd+s/ctrl+s for Save (Windows/Mac)
209 if ((evt.keyCode == Keyboard.S) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) { 209 if ((evt.keyCode == Keyboard.S) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) {
210 NJevent("executeSave"); 210 try{
211 NJevent("executeSave");
212 }
213 catch(e){
214 console.warn("Unable to save");
215 console.log(e.stack);
216 }
211 evt.preventDefault(); 217 evt.preventDefault();
212 return; 218 return;
213 } 219 }
diff --git a/js/stage/layout.js b/js/stage/layout.js
index a94dd10c..de4c67c1 100755
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -98,6 +98,11 @@ exports.Layout = Montage.create(Component, {
98 98
99 handleSelectionChange: { 99 handleSelectionChange: {
100 value: function(event) { 100 value: function(event) {
101
102 if(this.application.ninja.documentController.activeDocument === null){
103 return;
104 }
105
101 // Make an array copy of the line node list which is not an array like object 106 // Make an array copy of the line node list which is not an array like object
102 this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0); 107 this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0);
103 108