diff options
Diffstat (limited to 'js/panels')
-rwxr-xr-x | js/panels/properties.reel/properties.js | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js index fa62c850..eb362796 100755 --- a/js/panels/properties.reel/properties.js +++ b/js/panels/properties.reel/properties.js | |||
@@ -46,7 +46,7 @@ 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 | 51 | ||
52 | // This will be a toggle option | 52 | // This will be a toggle option |
@@ -54,9 +54,6 @@ exports.Properties = Montage.create(Component, { | |||
54 | this.eventManager.addEventListener( "elementChanging", this, false); | 54 | this.eventManager.addEventListener( "elementChanging", this, false); |
55 | } | 55 | } |
56 | 56 | ||
57 | this.eventManager.addEventListener("openDocument", this, false); | ||
58 | this.eventManager.addEventListener("switchDocument", this, false); | ||
59 | |||
60 | this.elementId.element.addEventListener("blur", this, false); | 57 | this.elementId.element.addEventListener("blur", this, false); |
61 | this.elementId.element.addEventListener("focus", this, false); | 58 | this.elementId.element.addEventListener("focus", this, false); |
62 | this.elementId.element.addEventListener("keyup", this, false); | 59 | this.elementId.element.addEventListener("keyup", this, false); |
@@ -71,26 +68,14 @@ exports.Properties = Montage.create(Component, { | |||
71 | value: function() { | 68 | value: function() { |
72 | this.eventManager.addEventListener( "elementChange", this, false); | 69 | this.eventManager.addEventListener( "elementChange", this, false); |
73 | 70 | ||
71 | // Save a reference of the pi inside the document view to be able to clear | ||
72 | this.application.ninja.currentDocument.model.views.design.propertiesPanel = this; | ||
73 | |||
74 | // Display the default document root PI | 74 | // Display the default document root PI |
75 | this.displayElementProperties(this.application.ninja.currentDocument.documentRoot); | 75 | this.displayElementProperties(this.application.ninja.currentDocument.documentRoot); |
76 | } | 76 | } |
77 | }, | 77 | }, |
78 | 78 | ||
79 | handleSwitchDocument: { | ||
80 | value: function(){ | ||
81 | // For now always assume that the stage is selected by default | ||
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 | } | ||
92 | }, | ||
93 | |||
94 | /** | 79 | /** |
95 | * Blur and Key up to handle change in the Element ID field. | 80 | * Blur and Key up to handle change in the Element ID field. |
96 | */ | 81 | */ |
@@ -181,6 +166,15 @@ exports.Properties = Montage.create(Component, { | |||
181 | } | 166 | } |
182 | }, | 167 | }, |
183 | 168 | ||
169 | clear: { | ||
170 | value: function() { | ||
171 | this.elementName.value = ""; | ||
172 | this.elementId.value = ""; | ||
173 | this.elementClass.value = ""; | ||
174 | this.customPi = null; | ||
175 | } | ||
176 | }, | ||
177 | |||
184 | displayElementProperties: { | 178 | displayElementProperties: { |
185 | value: function (el) { | 179 | value: function (el) { |
186 | var customPI, currentValue, isRoot = this.application.ninja.selectionController.isDocument; | 180 | var customPI, currentValue, isRoot = this.application.ninja.selectionController.isDocument; |
@@ -226,9 +220,16 @@ exports.Properties = Montage.create(Component, { | |||
226 | this.displayCustomProperties(el, el.elementModel.pi); | 220 | this.displayCustomProperties(el, el.elementModel.pi); |
227 | } | 221 | } |
228 | 222 | ||
223 | // Root element color chip | ||
229 | if(isRoot) { | 224 | if(isRoot) { |
230 | var backgroundChip = this.customSections[0].content.controls["background"]; | 225 | var backgroundChip = this.customSections[0].content.controls["background"]; |
231 | if(backgroundChip) backgroundChip.color = ElementsMediator.getProperty(el, "background"); | 226 | var rootBackgroundColor = ElementsMediator.getProperty(el, "background"); |
227 | |||
228 | if(rootBackgroundColor) { | ||
229 | backgroundChip.color = rootBackgroundColor; | ||
230 | } else { | ||
231 | backgroundChip.color = null; | ||
232 | } | ||
232 | } | 233 | } |
233 | 234 | ||
234 | var previousInput = this.application.ninja.colorController.colorModel.input; | 235 | var previousInput = this.application.ninja.colorController.colorModel.input; |