From 0e221e80eb41bbe770c195838373b9e27de54c7a Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 6 Mar 2012 16:11:52 -0800 Subject: IKNINJA-1207: added check for design view to fix js error Signed-off-by: Ananya Sen --- js/stage/layout.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'js/stage') diff --git a/js/stage/layout.js b/js/stage/layout.js index de4c67c1..ab2daf9b 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -65,8 +65,9 @@ exports.Layout = Montage.create(Component, { handleOpenDocument: { value: function() { // Initial elements to draw is the entire node list - this.elementsToDraw = this.application.ninja.documentController.activeDocument._liveNodeList; - + if(typeof this.application.ninja.documentController.activeDocument._liveNodeList !== "undefined"){//only for designer view + this.elementsToDraw = this.application.ninja.documentController.activeDocument._liveNodeList; + } // Draw the elements and the 3d info this.draw(); this.draw3DInfo(false); @@ -104,8 +105,9 @@ exports.Layout = Montage.create(Component, { } // Make an array copy of the line node list which is not an array like object - this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0); - + if(typeof this.application.ninja.documentController.activeDocument._liveNodeList !== "undefined"){//only for designer view + this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0); + } // Clear the elements to draw this.elementsToDraw.length = 0; -- cgit v1.2.3 From 2364c671ffc2953e3ee8dfdf037244de8fab3920 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 6 Mar 2012 16:30:33 -0800 Subject: IKNINJA-1238 fix and fixing other js errors on switching and closing documents Signed-off-by: Ananya Sen --- js/stage/stage-view.reel/stage-view.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'js/stage') diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index 91047e51..ad67cada 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js @@ -125,6 +125,10 @@ exports.StageView = Montage.create(Component, { this.application.ninja.documentController.activeDocument = doc; + if(this.application.ninja.documentController.activeDocument.currentView === "design") { + this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument; + } + this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe this.application.ninja.documentController._showCurrentDocument(); @@ -135,7 +139,6 @@ exports.StageView = Montage.create(Component, { if(this.application.ninja.documentController.activeDocument.currentView === "design") { this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe - this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument; //reinitialize draw-util, snapmanager and view-util this.application.ninja.stage.stageDeps.reinitializeForSwitchDocument(); -- cgit v1.2.3 From 250420d8c6154172b27fe53aff30e78c227e8a67 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 7 Mar 2012 14:26:37 -0800 Subject: minor fixes Signed-off-by: Ananya Sen --- js/stage/layout.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/stage') 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, { handleOpenDocument: { value: function() { // Initial elements to draw is the entire node list - if(typeof this.application.ninja.documentController.activeDocument._liveNodeList !== "undefined"){//only for designer view + if(this.application.ninja.documentController.activeDocument.currentView === "design"){//only for designer view this.elementsToDraw = this.application.ninja.documentController.activeDocument._liveNodeList; } // Draw the elements and the 3d info @@ -105,7 +105,7 @@ exports.Layout = Montage.create(Component, { } // Make an array copy of the line node list which is not an array like object - if(typeof this.application.ninja.documentController.activeDocument._liveNodeList !== "undefined"){//only for designer view + if(this.application.ninja.documentController.activeDocument.currentView === "design"){//only for designer view this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0); } // Clear the elements to draw -- cgit v1.2.3