aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel/style-declaration.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/css-panel/style-declaration.reel')
-rw-r--r--js/panels/css-panel/style-declaration.reel/style-declaration.html3
-rw-r--r--js/panels/css-panel/style-declaration.reel/style-declaration.js29
2 files changed, 20 insertions, 12 deletions
diff --git a/js/panels/css-panel/style-declaration.reel/style-declaration.html b/js/panels/css-panel/style-declaration.reel/style-declaration.html
index b1381bc6..9fc45640 100644
--- a/js/panels/css-panel/style-declaration.reel/style-declaration.html
+++ b/js/panels/css-panel/style-declaration.reel/style-declaration.html
@@ -22,6 +22,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
22 }, 22 },
23 "arrayController": { 23 "arrayController": {
24 "prototype": "montage/ui/controller/array-controller", 24 "prototype": "montage/ui/controller/array-controller",
25 "properties": {
26 "automaticallyOrganizeObjects": true
27 },
25 "bindings": { 28 "bindings": {
26 "content": { 29 "content": {
27 "boundObject": {"@": "owner"}, 30 "boundObject": {"@": "owner"},
diff --git a/js/panels/css-panel/style-declaration.reel/style-declaration.js b/js/panels/css-panel/style-declaration.reel/style-declaration.js
index 8e364d0d..711879ce 100644
--- a/js/panels/css-panel/style-declaration.reel/style-declaration.js
+++ b/js/panels/css-panel/style-declaration.reel/style-declaration.js
@@ -32,14 +32,15 @@ exports.StyleDeclaration = Montage.create(Component, {
32 return -1; 32 return -1;
33 } 33 }
34 34
35 return 0;
35 ///// Alphabetic sort based on property name 36 ///// Alphabetic sort based on property name
36 if (styleA.name < styleB.name) { 37// if (styleA.name < styleB.name) {
37 return -1; 38// return -1;
38 } else if (styleA.name > styleB.name) { 39// } else if (styleA.name > styleB.name) {
39 return 1; 40// return 1;
40 } else { 41// } else {
41 return 0; 42// return 0;
42 } 43// }
43 } 44 }
44 }, 45 },
45 _styleFilterFunction: { 46 _styleFilterFunction: {
@@ -173,6 +174,7 @@ exports.StyleDeclaration = Montage.create(Component, {
173 //// if shorthand exists in list of rendered styles 174 //// if shorthand exists in list of rendered styles
174 //// update it 175 //// update it
175 this.styles[shorthandIndex].value = this.declaration.getPropertyValue(shorthand); 176 this.styles[shorthandIndex].value = this.declaration.getPropertyValue(shorthand);
177 usedIndices.push(shorthandIndex);
176 shorthandUpdated = true; 178 shorthandUpdated = true;
177 } 179 }
178 }, this); 180 }, this);
@@ -225,13 +227,16 @@ exports.StyleDeclaration = Montage.create(Component, {
225 isEmpty: false 227 isEmpty: false
226 }, prop; 228 }, prop;
227 229
230 console.log('adding "'+ property+'" with value "' + value + '"');
231
228 for(prop in data) { 232 for(prop in data) {
229 if(data.hasOwnProperty(prop)) { 233 if(data.hasOwnProperty(prop)) {
230 styleDescriptor[prop] = data[prop]; 234 styleDescriptor[prop] = data[prop];
231 } 235 }
232 } 236 }
233 237
234 this.styles.push(styleDescriptor); 238 //this.styles.push(styleDescriptor);
239 this.arrayController.addObjects(styleDescriptor);
235 240
236 this.needsSort = this.needsDraw = true; 241 this.needsSort = this.needsDraw = true;
237 } 242 }
@@ -239,9 +244,9 @@ exports.StyleDeclaration = Montage.create(Component, {
239 removeStyle : { 244 removeStyle : {
240 value: function(styleDescriptor) { 245 value: function(styleDescriptor) {
241 var styleDescriptorIndex = this.styles.indexOf(styleDescriptor); 246 var styleDescriptorIndex = this.styles.indexOf(styleDescriptor);
242 247console.log("removing style", styleDescriptor);
243 this.styles.splice(styleDescriptorIndex, 1); 248 //this.styles.splice(styleDescriptorIndex, 1);
244 //this.arrayController.removeObjects(styleDescriptor); 249 this.arrayController.removeObjects(styleDescriptor);
245 250
246 //this.needsDraw = true; 251 //this.needsDraw = true;
247 } 252 }
@@ -281,7 +286,7 @@ exports.StyleDeclaration = Montage.create(Component, {
281 if(this.focusDelegate) { 286 if(this.focusDelegate) {
282 this.styleComponent.delegate = this.focusDelegate; 287 this.styleComponent.delegate = this.focusDelegate;
283 } 288 }
284 //this.arrayController.sortFunction = this._styleSortFunction; 289 this.arrayController.sortFunction = this._styleSortFunction;
285 } 290 }
286 }, 291 },
287 292