aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/selection-controller.js31
1 files changed, 4 insertions, 27 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index 6d982e69..b327bea4 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -34,13 +34,14 @@ exports.SelectionController = Montage.create(Component, {
34 } 34 }
35 35
36 if(this._currentDocument && this._currentDocument.currentView === "design") { 36 if(this._currentDocument && this._currentDocument.currentView === "design") {
37 this.ignoreFlag = false;
38 this._currentDocument.model._selection = this.application.ninja.selectedElements; 37 this._currentDocument.model._selection = this.application.ninja.selectedElements;
39// this._currentDocument.model.selectionContainer = this.application.ninja._currentSelectedContainer;
40 } 38 }
41 39
42 this._currentDocument = value; 40 this._currentDocument = value;
43 41
42 if(this._currentDocument && this._currentDocument.currentView === "design") {
43 this.selectedElements = this._currentDocument.model.selection;
44 }
44 /* 45 /*
45 if(!value) { 46 if(!value) {
46 } else if(this._currentDocument.currentView === "design") { 47 } else if(this._currentDocument.currentView === "design") {
@@ -51,10 +52,6 @@ exports.SelectionController = Montage.create(Component, {
51 } 52 }
52 }, 53 },
53 54
54 ignoreFlag: {
55 value: true
56 },
57
58 _selectedElements: { 55 _selectedElements: {
59 value: null 56 value: null
60 }, 57 },
@@ -64,21 +61,17 @@ exports.SelectionController = Montage.create(Component, {
64 return this._selectedElements; 61 return this._selectedElements;
65 }, 62 },
66 set: function(value) { 63 set: function(value) {
67 if(this.currentDocument && this.currentDocument.currentView === "code") return;
68 64
69 if(value) { 65 if(value) {
70 this._selectedElements = value; 66 this._selectedElements = value;
71 67
72 this.application.ninja.selectedElements = this._selectedElements; 68 this.application.ninja.selectedElements = this._selectedElements;
73// this.application.ninja._currentSelectedContainer = this._selectionContainer = this.application.ninja.currentDocument.model.documentRoot;
74 69
75 if(this._selectedElements.length === 0) { 70 if(this._selectedElements.length === 0) {
76 this.executeSelectElement(); 71 this.executeSelectElement();
77 } else { 72 } else {
78 this.executeSelectElement(this._selectedElements); 73 this.executeSelectElement(this._selectedElements);
79 } 74 }
80
81
82 } 75 }
83 } 76 }
84 }, 77 },
@@ -89,22 +82,6 @@ exports.SelectionController = Montage.create(Component, {
89 this.eventManager.addEventListener("elementsRemoved", this, false); 82 this.eventManager.addEventListener("elementsRemoved", this, false);
90 this.eventManager.addEventListener("elementReplaced", this, false); 83 this.eventManager.addEventListener("elementReplaced", this, false);
91 this.eventManager.addEventListener("selectAll", this, false); 84 this.eventManager.addEventListener("selectAll", this, false);
92
93 this.addPropertyChangeListener("currentDocument.model.domContainer", this);
94 }
95 },
96
97 handleChange: {
98 value: function() {
99 if(this.ignoreFlag) {
100 if(this.currentDocument && this.currentDocument.model.getProperty("domContainer")) {
101 if(this.currentDocument.model.getProperty("domContainer") !== null) {
102 this.executeSelectElement();
103 }
104 }
105 } else {
106 this.ignoreFlag = true;
107 }
108 } 85 }
109 }, 86 },
110 87
@@ -134,7 +111,7 @@ exports.SelectionController = Montage.create(Component, {
134 value: function(event) { 111 value: function(event) {
135 var selected = [], childNodes = [], self = this; 112 var selected = [], childNodes = [], self = this;
136 113
137 childNodes = this.application.ninja.currentDocument.model.documentRoot.childNodes; 114 childNodes = this.currentDocument.model.domContainer.childNodes;
138 childNodes = Array.prototype.slice.call(childNodes, 0); 115 childNodes = Array.prototype.slice.call(childNodes, 0);
139 childNodes.forEach(function(item) { 116 childNodes.forEach(function(item) {
140 if(self.isNodeTraversable(item)) { 117 if(self.isNodeTraversable(item)) {