aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-13 16:54:58 -0800
committerJose Antonio Marquez2012-02-13 16:54:58 -0800
commit5b55cfe0bc333a9a18be6329fdc21b5a6652a15a (patch)
tree80b4329906818890bc0a569bcce2b345fc8b062d /js/panels
parentf70701db069a10dc5195605fc378a022125b434f (diff)
parent30b23f8d0343c1af805d62894591001f19c6fb79 (diff)
downloadninja-5b55cfe0bc333a9a18be6329fdc21b5a6652a15a.tar.gz
Merge branch 'refs/heads/NinjaInternal' into FileIO
Diffstat (limited to 'js/panels')
-rwxr-xr-xjs/panels/properties/content.reel/content.js29
-rwxr-xr-xjs/panels/properties/sections/custom.reel/custom.js51
2 files changed, 75 insertions, 5 deletions
diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js
index 51b776f1..53926c78 100755
--- a/js/panels/properties/content.reel/content.js
+++ b/js/panels/properties/content.reel/content.js
@@ -159,6 +159,35 @@ exports.Content = Montage.create(Component, {
159 this.customPi = stage.elementModel.pi; 159 this.customPi = stage.elementModel.pi;
160 this.displayCustomProperties(stage, stage.elementModel.pi); 160 this.displayCustomProperties(stage, stage.elementModel.pi);
161 } 161 }
162
163 // For now hardcode the background since it is the only custom property
164 // No need to loop through all the properties.
165 var backgroundChip = this.customSections[0].content.controls["background"];
166 backgroundChip.initialColor = ElementsMediator.getProperty(stage, "background");
167
168 /*
169 var customPI = PiData[this.customPi];
170 // Get all the custom section for the custom PI
171 for(var i = 0, customSec; customSec = customPI[i]; i++) {
172
173 // Now set the Fields for the custom PI
174 for(var j = 0, fields; fields = customSec.Section[j]; j++) {
175 for(var k = 0, control; control = fields[k]; k++) {
176
177 var colorChipEl = this.customSections[i].content.controls[control.id];
178 this.foo = colorChipEl;
179 colorChipEl.addEventListener("firstDraw", this, false);
180
181 }
182 }
183 }
184 */
185 }
186 },
187
188 handleFirstDraw: {
189 value: function() {
190 this.foo.chipBtn.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 255, g: 0, b: 0}, css: 'rgb(255,0,0)'});
162 } 191 }
163 }, 192 },
164 193
diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js
index 992db8e6..a2b9b9fa 100755
--- a/js/panels/properties/sections/custom.reel/custom.js
+++ b/js/panels/properties/sections/custom.reel/custom.js
@@ -6,6 +6,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
6 6
7var Montage = require("montage/core/core").Montage; 7var Montage = require("montage/core/core").Montage;
8var Component = require("montage/ui/component").Component; 8var Component = require("montage/ui/component").Component;
9var ElementsMediator = require("js/mediators/element-mediator").ElementMediator;
9 10
10//Custom Rows 11//Custom Rows
11var SingleRow = require("js/panels/properties/sections/custom-rows/single-row.reel").SingleRow; 12var SingleRow = require("js/panels/properties/sections/custom-rows/single-row.reel").SingleRow;
@@ -18,7 +19,7 @@ var Dropdown = require("js/components/combobox.reel").Combobox;
18var TextField = require("js/components/textfield.reel").TextField; 19var TextField = require("js/components/textfield.reel").TextField;
19var FileInput = require("js/components/ui/file-input.reel").FileInput; 20var FileInput = require("js/components/ui/file-input.reel").FileInput;
20var Checkbox = require("js/components/checkbox.reel").Checkbox; 21var Checkbox = require("js/components/checkbox.reel").Checkbox;
21 22var ColorChip = require("js/components/ui/color-chip.reel").ColorChip;
22 23
23exports.CustomSection = Montage.create(Component, { 24exports.CustomSection = Montage.create(Component, {
24 25
@@ -88,10 +89,8 @@ exports.CustomSection = Montage.create(Component, {
88 value:{} 89 value:{}
89 }, 90 },
90 91
91 handleChanging: 92 handleChanging: {
92 { 93 value:function(event) {
93 value:function(event)
94 {
95 var obj = event.currentTarget; 94 var obj = event.currentTarget;
96 this._dispatchPropEvent({"type": "changing", "id": obj.id, "prop": obj.prop, "value": obj.value, "control": obj}); 95 this._dispatchPropEvent({"type": "changing", "id": obj.id, "prop": obj.prop, "value": obj.value, "control": obj});
97 } 96 }
@@ -106,6 +105,27 @@ exports.CustomSection = Montage.create(Component, {
106 } 105 }
107 }, 106 },
108 107
108 /**
109 * Color change handler. Hard coding the stage for now since only the stage PI uses this color chip
110 */
111 handleColorChange: {
112 value: function(event) {
113 // Change the stage color for now
114 //console.log(this, event);
115 ElementsMediator.setProperty([this.application.ninja.currentDocument.documentRoot], this.id, [event._event.color.css], "Change", "pi", '');
116 /*
117 var propEvent = document.createEvent("CustomEvent");
118 propEvent.initEvent("propertyChange", true, true);
119 propEvent.type = "propertyChange";
120
121 propEvent.prop = "background";//event.prop;
122 propEvent.value = event._event.color.css;
123
124 this.dispatchEvent(propEvent);
125 */
126 }
127 },
128
109 _dispatchPropEvent: { 129 _dispatchPropEvent: {
110 value: function(event) { 130 value: function(event) {
111// console.log(event); 131// console.log(event);
@@ -140,6 +160,7 @@ exports.CustomSection = Montage.create(Component, {
140 case "textbox" : return this.createTextField(fields); 160 case "textbox" : return this.createTextField(fields);
141 case "file" : return this.createFileInput(fields); 161 case "file" : return this.createFileInput(fields);
142 case "checkbox" : return this.createCheckbox(fields); 162 case "checkbox" : return this.createCheckbox(fields);
163 case "chip" : return this.createColorChip(fields);
143 } 164 }
144 } 165 }
145 }, 166 },
@@ -305,6 +326,26 @@ exports.CustomSection = Montage.create(Component, {
305 326
306 return obj; 327 return obj;
307 } 328 }
329 },
330
331 createColorChip: {
332 value: function(aField) {
333 var obj = ColorChip.create();
334
335 obj.chip = true;
336 obj.iconType = "fillIcon";
337 obj.mode = "chip";
338 obj.offset = 0;
339
340 if (aField.id) obj.id = aField.id;
341 if (aField.prop) obj.prop = aField.prop;
342
343 obj.changeDelegate = this.handleColorChange;
344
345 this.controls[aField.id] = obj;
346
347 return obj;
348 }
308 } 349 }
309 350
310}); \ No newline at end of file 351}); \ No newline at end of file