From ee54342b5f4fdd41c46543d6402e649e4b3d57cb Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 22 May 2012 17:58:23 -0700 Subject: - don't redraw stage for code document - fixes a switching bug - fix for ctrl+S for code document - disallow opening the panels while in code document Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 5 +++++ js/helper-classes/3D/view-utils.js | 4 ++-- js/mediators/keyboard-mediator.js | 2 +- js/panels/Splitter.js | 7 +++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index d99fadbb..91f4753d 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -524,6 +524,11 @@ var DocumentController = exports.DocumentController = Montage.create(Component, this.application.ninja.stage.hideCanvas(true); this.application.ninja.stage.hideRulers(); } + }else if(!currentDocument && newDocument.currentView === "code"){ + this.application.ninja.stage.showCodeViewBar(true); + this.application.ninja.stage.collapseAllPanels(); + this.application.ninja.stage.hideCanvas(true); + this.application.ninja.stage.hideRulers(); } this.application.ninja.stage.clearAllCanvas(); diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 0080bf90..0a4fe0ac 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -1005,9 +1005,9 @@ exports.ViewUtils = Montage.create(Component, { this.popViewportObj(); if (elt === this.application.ninja.currentDocument.documentRoot) break; - if (elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; + if (this.application.ninja.currentDocument.documentRoot && elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; elt = elt.offsetParent; - if (elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; + if (this.application.ninja.currentDocument.documentRoot && elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; } return mat; diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 23a2ce75..2f55edb4 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js @@ -88,7 +88,7 @@ exports.KeyboardMediator = Montage.create(Component, { //keyboard controls for html design view // TODO - New template mode doesn't set currentView yet. - if((!!this.application.ninja.currentDocument)){// && (this.application.ninja.currentDocument.model.currentView === "design")){ + if((!!this.application.ninja.currentDocument) && (this.application.ninja.currentDocument.model.currentView === "design")){ // Don't do anything if an input or other control is focused if(document.activeElement.nodeName !== "BODY") { diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js index 0640abb2..8675d314 100755 --- a/js/panels/Splitter.js +++ b/js/panels/Splitter.js @@ -111,8 +111,9 @@ exports.Splitter = Montage.create(Component, { } else { this.panel.removeEventListener("webkitTransitionEnd", this, false); } - - this.application.ninja.stage.resizeCanvases = true; + if(this.application.ninja.currentDocument.currentView === "design"){ + this.application.ninja.stage.resizeCanvases = true; + } } }, @@ -149,6 +150,7 @@ exports.Splitter = Montage.create(Component, { this.panel.addEventListener("webkitTransitionEnd", this, false); } this._collapsed = true; + this.disabled = true; this.needsDraw = true; } } @@ -169,6 +171,7 @@ exports.Splitter = Montage.create(Component, { } else { this.panel.addEventListener("webkitTransitionEnd", this, false); } + this.disabled = false; this.needsDraw = true; } } -- cgit v1.2.3 From 26d4cbf0f5c65f60051273f1648a0e8005d8c78a Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 23 May 2012 13:40:56 -0700 Subject: - removed redundant change - fixed js error on click of splitters when no documents are open Signed-off-by: Ananya Sen --- js/helper-classes/3D/view-utils.js | 4 ++-- js/panels/Splitter.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 0a4fe0ac..0080bf90 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -1005,9 +1005,9 @@ exports.ViewUtils = Montage.create(Component, { this.popViewportObj(); if (elt === this.application.ninja.currentDocument.documentRoot) break; - if (this.application.ninja.currentDocument.documentRoot && elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; + if (elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; elt = elt.offsetParent; - if (this.application.ninja.currentDocument.documentRoot && elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; + if (elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; } return mat; diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js index 8675d314..f0fb1a45 100755 --- a/js/panels/Splitter.js +++ b/js/panels/Splitter.js @@ -111,7 +111,7 @@ exports.Splitter = Montage.create(Component, { } else { this.panel.removeEventListener("webkitTransitionEnd", this, false); } - if(this.application.ninja.currentDocument.currentView === "design"){ + if(this.application.ninja.currentDocument && this.application.ninja.currentDocument.currentView === "design"){ this.application.ninja.stage.resizeCanvases = true; } } -- cgit v1.2.3