aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/selection-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/selection-controller.js')
-rwxr-xr-xjs/controllers/selection-controller.js22
1 files changed, 4 insertions, 18 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index 9ae1cfc9..b327bea4 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -35,11 +35,13 @@ exports.SelectionController = Montage.create(Component, {
35 35
36 if(this._currentDocument && this._currentDocument.currentView === "design") { 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;
39 } 38 }
40 39
41 this._currentDocument = value; 40 this._currentDocument = value;
42 41
42 if(this._currentDocument && this._currentDocument.currentView === "design") {
43 this.selectedElements = this._currentDocument.model.selection;
44 }
43 /* 45 /*
44 if(!value) { 46 if(!value) {
45 } else if(this._currentDocument.currentView === "design") { 47 } else if(this._currentDocument.currentView === "design") {
@@ -59,21 +61,17 @@ exports.SelectionController = Montage.create(Component, {
59 return this._selectedElements; 61 return this._selectedElements;
60 }, 62 },
61 set: function(value) { 63 set: function(value) {
62 if(this.currentDocument && this.currentDocument.currentView === "code") return;
63 64
64 if(value) { 65 if(value) {
65 this._selectedElements = value; 66 this._selectedElements = value;
66 67
67 this.application.ninja.selectedElements = this._selectedElements; 68 this.application.ninja.selectedElements = this._selectedElements;
68// this.application.ninja._currentSelectedContainer = this._selectionContainer = this.application.ninja.currentDocument.model.documentRoot;
69 69
70 if(this._selectedElements.length === 0) { 70 if(this._selectedElements.length === 0) {
71 this.executeSelectElement(); 71 this.executeSelectElement();
72 } else { 72 } else {
73 this.executeSelectElement(this._selectedElements); 73 this.executeSelectElement(this._selectedElements);
74 } 74 }
75
76
77 } 75 }
78 } 76 }
79 }, 77 },
@@ -84,18 +82,6 @@ exports.SelectionController = Montage.create(Component, {
84 this.eventManager.addEventListener("elementsRemoved", this, false); 82 this.eventManager.addEventListener("elementsRemoved", this, false);
85 this.eventManager.addEventListener("elementReplaced", this, false); 83 this.eventManager.addEventListener("elementReplaced", this, false);
86 this.eventManager.addEventListener("selectAll", this, false); 84 this.eventManager.addEventListener("selectAll", this, false);
87
88 this.addPropertyChangeListener("currentDocument.model.domContainer", this);
89 }
90 },
91
92 handleChange: {
93 value: function() {
94 if(this.currentDocument && this.currentDocument.model.getProperty("domContainer")) {
95 if(this.currentDocument.model.getProperty("domContainer") !== null) {
96 this.executeSelectElement();
97 }
98 }
99 } 85 }
100 }, 86 },
101 87
@@ -125,7 +111,7 @@ exports.SelectionController = Montage.create(Component, {
125 value: function(event) { 111 value: function(event) {
126 var selected = [], childNodes = [], self = this; 112 var selected = [], childNodes = [], self = this;
127 113
128 childNodes = this.application.ninja.currentDocument.model.documentRoot.childNodes; 114 childNodes = this.currentDocument.model.domContainer.childNodes;
129 childNodes = Array.prototype.slice.call(childNodes, 0); 115 childNodes = Array.prototype.slice.call(childNodes, 0);
130 childNodes.forEach(function(item) { 116 childNodes.forEach(function(item) {
131 if(self.isNodeTraversable(item)) { 117 if(self.isNodeTraversable(item)) {