diff options
author | Ananya Sen | 2012-02-23 13:43:35 -0800 |
---|---|---|
committer | Ananya Sen | 2012-02-23 13:43:35 -0800 |
commit | 7283884c39df537694b21419a3ea9e3ca7793b4b (patch) | |
tree | bd48aebcfdb2ba36721360a47c1654f22b9f75b6 /js/stage/stage-view.reel | |
parent | dbf0ca5637a3bca87c21c65ada47f8a4d794f78c (diff) | |
download | ninja-7283884c39df537694b21419a3ea9e3ca7793b4b.tar.gz |
switch html document - re-initialize draw-utils and snap-manager on opening a document and while switching documents
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/stage/stage-view.reel')
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.js | 14 |
1 files changed, 5 insertions, 9 deletions
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, { | |||
122 | 122 | ||
123 | switchDocument:{ | 123 | switchDocument:{ |
124 | value: function(doc){ | 124 | value: function(doc){ |
125 | //save editor cursor position | ||
126 | if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ | ||
127 | this.application.ninja.documentController.activeDocument.hline = this.application.ninja.documentController.activeDocument.editor.getCursor(true); | ||
128 | } | ||
129 | this.application.ninja.documentController._hideCurrentDocument(); | 125 | this.application.ninja.documentController._hideCurrentDocument(); |
130 | 126 | ||
131 | this.application.ninja.documentController.activeDocument = doc; | 127 | this.application.ninja.documentController.activeDocument = doc; |
@@ -133,17 +129,17 @@ exports.StageView = Montage.create(Component, { | |||
133 | this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe | 129 | this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe |
134 | this.application.ninja.documentController._showCurrentDocument(); | 130 | this.application.ninja.documentController._showCurrentDocument(); |
135 | 131 | ||
136 | var documentController = this.application.ninja.documentController; | 132 | //focus current document |
137 | |||
138 | //restore editor cursor position | ||
139 | if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ | 133 | if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ |
140 | this.application.ninja.documentController.activeDocument.editor.setCursor(this.application.ninja.documentController.activeDocument.hline); | ||
141 | document.getElementById("codeMirror_"+this.application.ninja.documentController.activeDocument.uuid).getElementsByClassName("CodeMirror")[0].focus(); | 134 | document.getElementById("codeMirror_"+this.application.ninja.documentController.activeDocument.uuid).getElementsByClassName("CodeMirror")[0].focus(); |
142 | } | 135 | } |
143 | 136 | ||
144 | if(this.application.ninja.documentController.activeDocument.currentView === "design") { | 137 | if(this.application.ninja.documentController.activeDocument.currentView === "design") { |
145 | this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe | 138 | this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe |
146 | this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument; | 139 | this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument; |
140 | |||
141 | this.application.ninja.stage.snapManager._isCacheInvalid=true; | ||
142 | this.application.ninja.stage.drawUtils.initializeFromDocument(); | ||
147 | 143 | ||
148 | // TODO dispatch event here | 144 | // TODO dispatch event here |
149 | // appDelegateModule.MyAppDelegate.onSetActiveDocument(); | 145 | // appDelegateModule.MyAppDelegate.onSetActiveDocument(); |