From 7283884c39df537694b21419a3ea9e3ca7793b4b Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 23 Feb 2012 13:43:35 -0800 Subject: switch html document - re-initialize draw-utils and snap-manager on opening a document and while switching documents Signed-off-by: Ananya Sen --- js/stage/stage-view.reel/stage-view.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'js/stage/stage-view.reel/stage-view.js') diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index dc9980f0..0b688c75 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js @@ -122,10 +122,6 @@ exports.StageView = Montage.create(Component, { switchDocument:{ value: function(doc){ - //save editor cursor position - if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ - this.application.ninja.documentController.activeDocument.hline = this.application.ninja.documentController.activeDocument.editor.getCursor(true); - } this.application.ninja.documentController._hideCurrentDocument(); this.application.ninja.documentController.activeDocument = doc; @@ -133,17 +129,17 @@ exports.StageView = Montage.create(Component, { this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe this.application.ninja.documentController._showCurrentDocument(); - var documentController = this.application.ninja.documentController; - - //restore editor cursor position + //focus current document if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ - this.application.ninja.documentController.activeDocument.editor.setCursor(this.application.ninja.documentController.activeDocument.hline); document.getElementById("codeMirror_"+this.application.ninja.documentController.activeDocument.uuid).getElementsByClassName("CodeMirror")[0].focus(); } 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; + this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument; + + this.application.ninja.stage.snapManager._isCacheInvalid=true; + this.application.ninja.stage.drawUtils.initializeFromDocument(); // TODO dispatch event here // appDelegateModule.MyAppDelegate.onSetActiveDocument(); -- cgit v1.2.3 From 6e66f411ba02eaaeb33471115345ecf3c7ce4ce9 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 23 Feb 2012 17:55:59 -0800 Subject: refresh draw-utils, snap-manager, view-utils for html document stitching Signed-off-by: Ananya Sen --- js/stage/stage-view.reel/stage-view.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'js/stage/stage-view.reel/stage-view.js') diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index 0b688c75..ab02661d 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js @@ -118,8 +118,7 @@ exports.StageView = Montage.create(Component, { } }, - - + //called for switching between html documents switchDocument:{ value: function(doc){ this.application.ninja.documentController._hideCurrentDocument(); @@ -138,8 +137,10 @@ exports.StageView = Montage.create(Component, { 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; - this.application.ninja.stage.snapManager._isCacheInvalid=true; - this.application.ninja.stage.drawUtils.initializeFromDocument(); + //reinitialize draw-util, snapmanager and view-util + this.application.ninja.stage.stageDeps.reinitializeForSwitchDocument(); + + //this.application.ninja.stage.layout.reinitializeForSwitchDocument(); // TODO dispatch event here // appDelegateModule.MyAppDelegate.onSetActiveDocument(); -- cgit v1.2.3 From 85d59d57ea556b114c5cad9b2ec67ccc27119380 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 24 Feb 2012 12:05:16 -0800 Subject: - added flag for timeline to identify new file flow - added switchDocument event for timeline Signed-off-by: Ananya Sen --- js/stage/stage-view.reel/stage-view.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/stage/stage-view.reel/stage-view.js') diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index ab02661d..91047e51 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js @@ -146,6 +146,8 @@ exports.StageView = Montage.create(Component, { // appDelegateModule.MyAppDelegate.onSetActiveDocument(); } + NJevent("switchDocument"); + } }, -- cgit v1.2.3