aboutsummaryrefslogtreecommitdiff
path: root/js/panels/properties.reel/properties.js
diff options
context:
space:
mode:
authorEric Guzman2012-06-11 13:28:42 -0700
committerEric Guzman2012-06-11 13:28:42 -0700
commit3a4727ffc350216a434a7c6977b6a23653b77780 (patch)
treec5dff306f8803c36a16163ba5df1e7f492e762b5 /js/panels/properties.reel/properties.js
parentd6b46ba496c9c8974ae39bb476aea35bcd1ddaf1 (diff)
parent337efc667372326ae2f9984d89a47bb151016774 (diff)
downloadninja-3a4727ffc350216a434a7c6977b6a23653b77780.tar.gz
Merge branch 'binding' of github.com:dhg637/ninja-internal into binding
Diffstat (limited to 'js/panels/properties.reel/properties.js')
-rwxr-xr-xjs/panels/properties.reel/properties.js68
1 files changed, 46 insertions, 22 deletions
diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js
index 84b0d589..cc99ca6c 100755
--- a/js/panels/properties.reel/properties.js
+++ b/js/panels/properties.reel/properties.js
@@ -13,6 +13,35 @@ var ElementsMediator = require("js/mediators/element-mediator").ElementMediator;
13 13
14exports.Properties = Montage.create(Component, { 14exports.Properties = Montage.create(Component, {
15 15
16 _currentDocument: {
17 value : null
18 },
19
20 currentDocument : {
21 get : function() {
22 return this._currentDocument;
23 },
24 set : function(value) {
25 if (value === this._currentDocument) {
26 return;
27 }
28
29 this._currentDocument = value;
30
31// if(!value) {
32 this.clear();
33// }
34
35 /*
36 else if(this._currentDocument.currentView === "design") {
37 // Display the default document root PI
38 //this.displayElementProperties(this._currentDocument.model.documentRoot);
39// this.displaySelection(this._currentDocument.model.selection);
40 }
41 */
42 }
43 },
44
16 elementName: { 45 elementName: {
17 value: null 46 value: null
18 }, 47 },
@@ -46,9 +75,8 @@ exports.Properties = Montage.create(Component, {
46 75
47 prepareForDraw: { 76 prepareForDraw: {
48 value : function() { 77 value : function() {
49 this.eventManager.addEventListener("openDocument", this, false); 78 this.eventManager.addEventListener("elementChange", this, false);
50 this.eventManager.addEventListener("selectionChange", this, false); 79 this.eventManager.addEventListener("selectionChange", this, false);
51 this.eventManager.addEventListener("closeDocument", this, false);
52 80
53 // This will be a toggle option 81 // This will be a toggle option
54 if(this.application.ninja.appData.PILiveUpdate) { 82 if(this.application.ninja.appData.PILiveUpdate) {
@@ -65,24 +93,6 @@ exports.Properties = Montage.create(Component, {
65 } 93 }
66 }, 94 },
67 95
68 handleOpenDocument: {
69 value: function() {
70 this.eventManager.addEventListener( "elementChange", this, false);
71
72 // Save a reference of the pi inside the document view to be able to clear
73 this.application.ninja.currentDocument.model.views.design.propertiesPanel = this;
74
75 // Display the default document root PI
76 this.displayElementProperties(this.application.ninja.currentDocument.model.documentRoot);
77 }
78 },
79
80 handleCloseDocument: {
81 value: function(){
82 this.clear();
83 }
84 },
85
86 /** 96 /**
87 * Blur and Key up to handle change in the Element ID field. 97 * Blur and Key up to handle change in the Element ID field.
88 */ 98 */
@@ -173,6 +183,20 @@ exports.Properties = Montage.create(Component, {
173 } 183 }
174 }, 184 },
175 185
186 displaySelection: {
187 value: function(selection) {
188 if(selection.length === 0) {
189 this.displayElementProperties(this._currentDocument.model.documentRoot);
190 } else {
191 if(selection.length === 1) {
192 this.displayElementProperties(this.application.ninja.selectedElements[0]);
193 } else {
194 this.displayGroupProperties(this.application.ninja.selectedElements);
195 }
196 }
197 }
198 },
199
176 clear: { 200 clear: {
177 value: function() { 201 value: function() {
178 this.elementName.value = ""; 202 this.elementName.value = "";
@@ -219,8 +243,8 @@ exports.Properties = Montage.create(Component, {
219 controls = this.customSections[n].content.controls; 243 controls = this.customSections[n].content.controls;
220 if(controls["colorSelect"]) { 244 if(controls["colorSelect"]) {
221 controls["colorSelect"].destroy(); 245 controls["colorSelect"].destroy();
222 } else if(controls["background"]) { 246 } else if(controls["background-color"]) {
223 controls["background"].destroy(); 247 controls["background-color"].destroy();
224 } 248 }
225 } 249 }
226 250