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.js53
1 files changed, 32 insertions, 21 deletions
diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js
index fa62c850..b292a66a 100755
--- a/js/panels/properties.reel/properties.js
+++ b/js/panels/properties.reel/properties.js
@@ -46,17 +46,15 @@ exports.Properties = Montage.create(Component, {
46 46
47 prepareForDraw: { 47 prepareForDraw: {
48 value : function() { 48 value : function() {
49 49 this.eventManager.addEventListener("openDocument", this, false);
50 this.eventManager.addEventListener("selectionChange", this, false); 50 this.eventManager.addEventListener("selectionChange", this, false);
51 this.eventManager.addEventListener("closeDocument", this, false);
51 52
52 // This will be a toggle option 53 // This will be a toggle option
53 if(this.application.ninja.appData.PILiveUpdate) { 54 if(this.application.ninja.appData.PILiveUpdate) {
54 this.eventManager.addEventListener( "elementChanging", this, false); 55 this.eventManager.addEventListener( "elementChanging", this, false);
55 } 56 }
56 57
57 this.eventManager.addEventListener("openDocument", this, false);
58 this.eventManager.addEventListener("switchDocument", this, false);
59
60 this.elementId.element.addEventListener("blur", this, false); 58 this.elementId.element.addEventListener("blur", this, false);
61 this.elementId.element.addEventListener("focus", this, false); 59 this.elementId.element.addEventListener("focus", this, false);
62 this.elementId.element.addEventListener("keyup", this, false); 60 this.elementId.element.addEventListener("keyup", this, false);
@@ -71,23 +69,17 @@ exports.Properties = Montage.create(Component, {
71 value: function() { 69 value: function() {
72 this.eventManager.addEventListener( "elementChange", this, false); 70 this.eventManager.addEventListener( "elementChange", this, false);
73 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
74 // Display the default document root PI 75 // Display the default document root PI
75 this.displayElementProperties(this.application.ninja.currentDocument.documentRoot); 76 this.displayElementProperties(this.application.ninja.currentDocument.documentRoot);
76 } 77 }
77 }, 78 },
78 79
79 handleSwitchDocument: { 80 handleCloseDocument: {
80 value: function(){ 81 value: function(){
81 // For now always assume that the stage is selected by default 82 this.clear();
82 if(this.application.ninja.selectedElements.length === 0) {
83 this.displayStageProperties();
84 } else {
85 if(this.application.ninja.selectedElements.length === 1) {
86 this.displayElementProperties(this.application.ninja.selectedElements[0]);
87 } else {
88 this.displayGroupProperties(this.application.ninja.selectedElements);
89 }
90 }
91 } 83 }
92 }, 84 },
93 85
@@ -181,6 +173,16 @@ exports.Properties = Montage.create(Component, {
181 } 173 }
182 }, 174 },
183 175
176 clear: {
177 value: function() {
178 this.elementName.value = "";
179 this.elementId.value = "";
180 this.elementClass.value = "";
181 this.customPi = null;
182 this.customSections = [];
183 }
184 },
185
184 displayElementProperties: { 186 displayElementProperties: {
185 value: function (el) { 187 value: function (el) {
186 var customPI, currentValue, isRoot = this.application.ninja.selectionController.isDocument; 188 var customPI, currentValue, isRoot = this.application.ninja.selectionController.isDocument;
@@ -217,20 +219,29 @@ exports.Properties = Montage.create(Component, {
217 controls = this.customSections[n].content.controls; 219 controls = this.customSections[n].content.controls;
218 if(controls["colorSelect"]) { 220 if(controls["colorSelect"]) {
219 controls["colorSelect"].destroy(); 221 controls["colorSelect"].destroy();
220 } else if(controls["stageBackground"]) { 222 } else if(controls["background"]) {
221 controls["stageBackground"].destroy(); 223 controls["background"].destroy();
222 } 224 }
223 } 225 }
224 226
225 this.customPi = el.elementModel.pi; 227 this.customPi = el.elementModel.pi;
226 this.displayCustomProperties(el, el.elementModel.pi); 228 this.displayCustomProperties(el, el.elementModel.pi);
227 }
228 229
229 if(isRoot) { 230 // Root element color chip
230 var backgroundChip = this.customSections[0].content.controls["background"]; 231 if(isRoot) {
231 if(backgroundChip) backgroundChip.color = ElementsMediator.getProperty(el, "background"); 232 var backgroundChip = this.customSections[0].content.controls["background"];
233 var rootBackgroundColor = ElementsMediator.getProperty(el, "background");
234
235 if(rootBackgroundColor) {
236 backgroundChip.color = rootBackgroundColor;
237 } else {
238 backgroundChip.color = null;
239 }
240 }
232 } 241 }
233 242
243
244
234 var previousInput = this.application.ninja.colorController.colorModel.input; 245 var previousInput = this.application.ninja.colorController.colorModel.input;
235 customPI = PiData[this.customPi]; 246 customPI = PiData[this.customPi];
236 // Get all the custom section for the custom PI 247 // Get all the custom section for the custom PI