aboutsummaryrefslogtreecommitdiff
path: root/js/panels/properties.reel/properties.js
diff options
context:
space:
mode:
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 7f8197ea..700b93f3 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 */
@@ -174,6 +184,20 @@ exports.Properties = Montage.create(Component, {
174 } 184 }
175 }, 185 },
176 186
187 displaySelection: {
188 value: function(selection) {
189 if(selection.length === 0) {
190 this.displayElementProperties(this._currentDocument.model.documentRoot);
191 } else {
192 if(selection.length === 1) {
193 this.displayElementProperties(this.application.ninja.selectedElements[0]);
194 } else {
195 this.displayGroupProperties(this.application.ninja.selectedElements);
196 }
197 }
198 }
199 },
200
177 clear: { 201 clear: {
178 value: function() { 202 value: function() {
179 this.elementName.value = ""; 203 this.elementName.value = "";
@@ -220,8 +244,8 @@ exports.Properties = Montage.create(Component, {
220 controls = this.customSections[n].content.controls; 244 controls = this.customSections[n].content.controls;
221 if(controls["colorSelect"]) { 245 if(controls["colorSelect"]) {
222 controls["colorSelect"].destroy(); 246 controls["colorSelect"].destroy();
223 } else if(controls["background"]) { 247 } else if(controls["background-color"]) {
224 controls["background"].destroy(); 248 controls["background-color"].destroy();
225 } 249 }
226 } 250 }
227 251