diff options
author | hwc487 | 2012-02-22 10:58:40 -0800 |
---|---|---|
committer | hwc487 | 2012-02-22 10:58:40 -0800 |
commit | 1a72686c9b915c488f9b430995787d2176671561 (patch) | |
tree | 849ca3d54f68c6c327c3daa240b48c7be6f73e91 /js/controllers/selection-controller.js | |
parent | bb441ec8f8080cdaa52257a40531c62c47028667 (diff) | |
parent | 2f24dafec79583547fe663d5a387d8ef15aae3bf (diff) | |
download | ninja-1a72686c9b915c488f9b430995787d2176671561.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into integration
Diffstat (limited to 'js/controllers/selection-controller.js')
-rwxr-xr-x | js/controllers/selection-controller.js | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 833e6f04..d69b53e0 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js | |||
@@ -20,6 +20,26 @@ exports.SelectionController = Montage.create(Component, { | |||
20 | } | 20 | } |
21 | }, | 21 | }, |
22 | 22 | ||
23 | /* | ||
24 | * Bound property to the ninja currentSelectedContainer | ||
25 | */ | ||
26 | _selectionContainer: { | ||
27 | value: null | ||
28 | }, | ||
29 | |||
30 | selectionContainer: { | ||
31 | get: function() { | ||
32 | return this._selectionContainer | ||
33 | }, | ||
34 | set: function(value) { | ||
35 | if(this._selectionContainer && this._selectionContainer !== value) { | ||
36 | this.executeSelectElement(); | ||
37 | } | ||
38 | |||
39 | this._selectionContainer = value; | ||
40 | } | ||
41 | }, | ||
42 | |||
23 | deserializedFromTemplate: { | 43 | deserializedFromTemplate: { |
24 | value: function() { | 44 | value: function() { |
25 | this.eventManager.addEventListener("openDocument", this, false); | 45 | this.eventManager.addEventListener("openDocument", this, false); |
@@ -53,7 +73,9 @@ exports.SelectionController = Montage.create(Component, { | |||
53 | } | 73 | } |
54 | } | 74 | } |
55 | 75 | ||
56 | this.dispatchEvent(selectionEvent.event); | 76 | // |
77 | this._selectionContainer = this.application.ninja.currentSelectedContainer; | ||
78 | |||
57 | } | 79 | } |
58 | }, | 80 | }, |
59 | 81 | ||
@@ -66,13 +88,10 @@ exports.SelectionController = Montage.create(Component, { | |||
66 | handleElementDeleted: { | 88 | handleElementDeleted: { |
67 | value: function(event) { | 89 | value: function(event) { |
68 | if(!this._isDocument) { | 90 | if(!this._isDocument) { |
69 | |||
70 | if(this.findSelectedElement(event.detail) !== -1) { | 91 | if(this.findSelectedElement(event.detail) !== -1) { |
71 | this.executeSelectElement(); | 92 | this.executeSelectElement(); |
72 | } | 93 | } |
73 | |||
74 | } | 94 | } |
75 | |||
76 | } | 95 | } |
77 | }, | 96 | }, |
78 | 97 | ||
@@ -130,12 +149,17 @@ exports.SelectionController = Montage.create(Component, { | |||
130 | this.executeSelectElement(); // Else execute selection with no item | 149 | this.executeSelectElement(); // Else execute selection with no item |
131 | } else { | 150 | } else { |
132 | 151 | ||
133 | if(item.parentNode.id == "UserContent") { | 152 | // if(item.parentNode.id === "UserContent") { |
153 | if(item.parentNode.uuid === this.selectionContainer.uuid) { | ||
134 | this.executeSelectElement(item); | 154 | this.executeSelectElement(item); |
135 | } else { | 155 | } else { |
136 | var outerElement = item.parentNode; | 156 | var outerElement = item.parentNode; |
137 | 157 | ||
138 | while(outerElement.parentNode && outerElement.parentNode.id !== "UserContent") { | 158 | while(outerElement.parentNode && outerElement.parentNode.uuid !== this.selectionContainer.uuid) { |
159 | //while(outerElement.parentNode && outerElement.parentNode.id !== "UserContent") { | ||
160 | // If element is higher up than current container then return | ||
161 | if(outerElement.id === "UserContent") return; | ||
162 | // else keep going up the chain | ||
139 | outerElement = outerElement.parentNode; | 163 | outerElement = outerElement.parentNode; |
140 | } | 164 | } |
141 | 165 | ||