diff options
-rwxr-xr-x | js/controllers/document-controller.js | 41 | ||||
-rwxr-xr-x | js/controllers/selection-controller.js | 6 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 10 |
3 files changed, 20 insertions, 37 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 72a669b3..0fe1636a 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -45,11 +45,6 @@ exports.DocumentController = Montage.create(Component, { | |||
45 | 45 | ||
46 | if(this._currentDocument) { | 46 | if(this._currentDocument) { |
47 | this._currentDocument.model.currentView.hide(); | 47 | this._currentDocument.model.currentView.hide(); |
48 | |||
49 | if(this._currentDocument.model.parentContainer !== value.model.parentContainer) { | ||
50 | this._currentDocument.model.parentContainer.style["display"] = "none"; | ||
51 | value.model.parentContainer.style["display"] = "block"; | ||
52 | } | ||
53 | } | 48 | } |
54 | 49 | ||
55 | this._currentDocument = value; | 50 | this._currentDocument = value; |
@@ -58,10 +53,13 @@ exports.DocumentController = Montage.create(Component, { | |||
58 | document.getElementById("iframeContainer").style.display = "block"; | 53 | document.getElementById("iframeContainer").style.display = "block"; |
59 | document.getElementById("codeViewContainer").style.display = "block"; | 54 | document.getElementById("codeViewContainer").style.display = "block"; |
60 | } else if(this._currentDocument.currentView === "design") { | 55 | } else if(this._currentDocument.currentView === "design") { |
56 | document.getElementById("codeViewContainer").style.display = "none"; | ||
57 | document.getElementById("iframeContainer").style.display = "block"; | ||
61 | this._currentDocument.model.currentView.show(); | 58 | this._currentDocument.model.currentView.show(); |
62 | this._currentDocument.model.views.design._liveNodeList = this._currentDocument.model.documentRoot.getElementsByTagName('*'); | 59 | this._currentDocument.model.views.design._liveNodeList = this._currentDocument.model.documentRoot.getElementsByTagName('*'); |
63 | } else { | 60 | } else { |
64 | document.getElementById("iframeContainer").style.display = "none"; | 61 | document.getElementById("iframeContainer").style.display = "none"; |
62 | this._currentDocument.model.parentContainer.style["display"] = "block"; | ||
65 | this._currentDocument.model.currentView.show(); | 63 | this._currentDocument.model.currentView.show(); |
66 | } | 64 | } |
67 | 65 | ||
@@ -355,26 +353,8 @@ exports.DocumentController = Montage.create(Component, { | |||
355 | switchDocuments: { | 353 | switchDocuments: { |
356 | value: function(currentDocument, newDocument, didCreate) { | 354 | value: function(currentDocument, newDocument, didCreate) { |
357 | 355 | ||
358 | if(currentDocument) { | 356 | if(currentDocument.currentView === "design") { |
359 | if(currentDocument.currentView === "design") { | 357 | currentDocument.serializeDocument(); |
360 | currentDocument.serializeDocument(); | ||
361 | } | ||
362 | |||
363 | |||
364 | |||
365 | if(currentDocument.currentView === "code" && newDocument.currentView === "design") { | ||
366 | this.application.ninja.stage.showCodeViewBar(false); | ||
367 | this.application.ninja.stage.restoreAllPanels(); | ||
368 | this.application.ninja.stage.hideCanvas(false); | ||
369 | this.application.ninja.stage.showRulers(); | ||
370 | } | ||
371 | } | ||
372 | |||
373 | if(newDocument.currentView === "code") { | ||
374 | this.application.ninja.stage.showCodeViewBar(true); | ||
375 | this.application.ninja.stage.collapseAllPanels(); | ||
376 | this.application.ninja.stage.hideCanvas(true); | ||
377 | this.application.ninja.stage.hideRulers(); | ||
378 | } | 358 | } |
379 | 359 | ||
380 | if(didCreate) { | 360 | if(didCreate) { |
@@ -384,19 +364,8 @@ exports.DocumentController = Montage.create(Component, { | |||
384 | newDocument.model.parentContainer.style["display"] = "block"; | 364 | newDocument.model.parentContainer.style["display"] = "block"; |
385 | } | 365 | } |
386 | } else { | 366 | } else { |
387 | this.activeDocument = newDocument; | ||
388 | |||
389 | newDocument.model.currentView.show(); | ||
390 | |||
391 | if(newDocument.currentView === "design") { | 367 | if(newDocument.currentView === "design") { |
392 | newDocument.deserializeDocument(); | 368 | newDocument.deserializeDocument(); |
393 | NJevent("onSwitchDocument"); | ||
394 | } else { | ||
395 | this.application.ninja.currentDocument = newDocument; | ||
396 | newDocument.model.views.code.editor.focus(); | ||
397 | |||
398 | newDocument.model.isActive = true; | ||
399 | this.application.ninja.codeEditorController.applySettings();//should be called after activeDocument is updated | ||
400 | } | 369 | } |
401 | } | 370 | } |
402 | } | 371 | } |
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index a219c597..28c0f3d3 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js | |||
@@ -33,17 +33,19 @@ exports.SelectionController = Montage.create(Component, { | |||
33 | return; | 33 | return; |
34 | } | 34 | } |
35 | 35 | ||
36 | if(this._currentDocument) { | 36 | if(this._currentDocument && this._currentDocument.currentView === "design") { |
37 | this._currentDocument.model.selection = this.application.ninja.selectedElements; | 37 | this._currentDocument.model.selection = this.application.ninja.selectedElements; |
38 | this._currentDocument.model.selectionContainer = this.application.ninja._currentSelectedContainer; | 38 | this._currentDocument.model.selectionContainer = this.application.ninja._currentSelectedContainer; |
39 | } | 39 | } |
40 | 40 | ||
41 | this._currentDocument = value; | 41 | this._currentDocument = value; |
42 | 42 | ||
43 | /* | ||
43 | if(!value) { | 44 | if(!value) { |
44 | } else if(this._currentDocument.currentView === "design") { | 45 | } else if(this._currentDocument.currentView === "design") { |
45 | } else { | 46 | } else { |
46 | } | 47 | } |
48 | */ | ||
47 | 49 | ||
48 | } | 50 | } |
49 | }, | 51 | }, |
@@ -57,6 +59,8 @@ exports.SelectionController = Montage.create(Component, { | |||
57 | return this._selectedElements; | 59 | return this._selectedElements; |
58 | }, | 60 | }, |
59 | set: function(value) { | 61 | set: function(value) { |
62 | if(this.currentDocument && this.currentDocument.currentView === "code") return; | ||
63 | |||
60 | if(value) { | 64 | if(value) { |
61 | this._selectedElements = value; | 65 | this._selectedElements = value; |
62 | 66 | ||
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 4c4ba6c9..cd08c55d 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -187,8 +187,18 @@ exports.Stage = Montage.create(Component, { | |||
187 | drawUtils._eltArray.length = 0; | 187 | drawUtils._eltArray.length = 0; |
188 | drawUtils._planesArray.length = 0; | 188 | drawUtils._planesArray.length = 0; |
189 | } else if(this._currentDocument.currentView === "design") { | 189 | } else if(this._currentDocument.currentView === "design") { |
190 | this.showCodeViewBar(false); | ||
191 | this.restoreAllPanels(); | ||
192 | this.hideCanvas(false); | ||
193 | this.showRulers(); | ||
194 | |||
190 | this.clearAllCanvas(); | 195 | this.clearAllCanvas(); |
191 | this.initWithDocument(false); | 196 | this.initWithDocument(false); |
197 | } else { | ||
198 | this.showCodeViewBar(true); | ||
199 | this.collapseAllPanels(); | ||
200 | this.hideCanvas(true); | ||
201 | this.hideRulers(); | ||
192 | } | 202 | } |
193 | } | 203 | } |
194 | }, | 204 | }, |