aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorAnanya Sen2012-02-23 13:43:35 -0800
committerAnanya Sen2012-02-23 13:43:35 -0800
commit7283884c39df537694b21419a3ea9e3ca7793b4b (patch)
treebd48aebcfdb2ba36721360a47c1654f22b9f75b6 /js/controllers
parentdbf0ca5637a3bca87c21c65ada47f8a4d794f78c (diff)
downloadninja-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/controllers')
-rwxr-xr-xjs/controllers/document-controller.js6
-rwxr-xr-xjs/controllers/elements/element-controller.js6
-rwxr-xr-xjs/controllers/selection-controller.js9
3 files changed, 17 insertions, 4 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 48e33267..f323ed99 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -321,7 +321,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
321 // Event Detail: Contains the current ActiveDocument 321 // Event Detail: Contains the current ActiveDocument
322 _onOpenDocument: { 322 _onOpenDocument: {
323 value: function(doc){ 323 value: function(doc){
324 //var data = DocumentManager.activeDocument; 324 this.application.ninja.currentDocument = doc;
325 this._hideCurrentDocument(); 325 this._hideCurrentDocument();
326 this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid); 326 this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid);
327 327
@@ -405,7 +405,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
405 value: function() { 405 value: function() {
406 if(this.activeDocument) { 406 if(this.activeDocument) {
407 if(this.activeDocument.currentView === "design"){ 407 if(this.activeDocument.currentView === "design"){
408 this.application.ninja.stage.saveScroll(); 408 this.activeDocument.saveAppState();
409 this.activeDocument.container.parentNode.style["display"] = "none"; 409 this.activeDocument.container.parentNode.style["display"] = "none";
410 this.application.ninja.stage.hideCanvas(true); 410 this.application.ninja.stage.hideCanvas(true);
411 this.application.ninja.stage.stageView.hideRulers(); 411 this.application.ninja.stage.stageView.hideRulers();
@@ -422,7 +422,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
422 this.activeDocument.container.style["display"] = "block"; 422 this.activeDocument.container.style["display"] = "block";
423 if(this.activeDocument.currentView === "design"){ 423 if(this.activeDocument.currentView === "design"){
424 this.activeDocument.container.parentNode.style["display"] = "block"; 424 this.activeDocument.container.parentNode.style["display"] = "block";
425 this.application.ninja.stage.restoreScroll(); 425 this.activeDocument.restoreAppState();
426 this.application.ninja.stage.hideCanvas(false); 426 this.application.ninja.stage.hideCanvas(false);
427 this.application.ninja.stage.stageView.showRulers(); 427 this.application.ninja.stage.stageView.showRulers();
428 }else{ 428 }else{
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index ac14def4..d6f2bc56 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -27,7 +27,11 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
27 27
28 getProperty: { 28 getProperty: {
29 value: function(el, prop, fallbackOnComputed, isStageElement) { 29 value: function(el, prop, fallbackOnComputed, isStageElement) {
30 return this.application.ninja.stylesController.getElementStyle(el, prop, fallbackOnComputed, isStageElement); 30 if(el.nodeType !== 3){
31 return this.application.ninja.stylesController.getElementStyle(el, prop, fallbackOnComputed, isStageElement);
32 }else{
33 return null;
34 }
31 } 35 }
32 }, 36 },
33 37
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index d69b53e0..f50762f3 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -58,6 +58,7 @@ exports.SelectionController = Montage.create(Component, {
58 handleOpenDocument: { 58 handleOpenDocument: {
59 value: function() { 59 value: function() {
60 // Handle initializing the selection array here. 60 // Handle initializing the selection array here.
61 this.initWithDocument([]);
61 } 62 }
62 }, 63 },
63 64
@@ -70,6 +71,14 @@ exports.SelectionController = Montage.create(Component, {
70 if(currentSelectionArray.length >= 1) { 71 if(currentSelectionArray.length >= 1) {
71 this._selectedItems = currentSelectionArray; 72 this._selectedItems = currentSelectionArray;
72 this._isDocument = false; 73 this._isDocument = false;
74
75
76
77 this.application.ninja.selectedElements = currentSelectionArray;
78 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
79
80
81
73 } 82 }
74 } 83 }
75 84