aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-08 13:14:29 -0800
committerJose Antonio Marquez2012-02-08 13:14:29 -0800
commit9b45b897949bf934c8bf2c90ee2ff78f8713cb12 (patch)
treee7c276a3934c823cab894f46ee7dc5d3eda9ca83 /js/panels
parentaa01c1210f3a4d9fd55a771b9de2c58ee3fa4bb6 (diff)
parent10cdeb52403f16d5d4be43a516e8cdfbc866a2a2 (diff)
downloadninja-9b45b897949bf934c8bf2c90ee2ff78f8713cb12.tar.gz
Merge branch 'refs/heads/NinjaInternal' into Color
Conflicts: js/controllers/elements/shapes-controller.js js/data/pi/pi-data.js js/panels/properties/content.reel/content.js
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/Color/colortoolbar.reel/colortoolbar.js8
-rw-r--r--js/panels/properties/content.reel/content.js32
-rw-r--r--js/panels/properties/sections/custom.reel/custom.js14
3 files changed, 39 insertions, 15 deletions
diff --git a/js/panels/Color/colortoolbar.reel/colortoolbar.js b/js/panels/Color/colortoolbar.reel/colortoolbar.js
index 10ae8b6e..6b8e476b 100644
--- a/js/panels/Color/colortoolbar.reel/colortoolbar.js
+++ b/js/panels/Color/colortoolbar.reel/colortoolbar.js
@@ -20,7 +20,7 @@ exports.ColorToolbar = Montage.create(Component, {
20 //Storing stroke (stores color in mode use to select color) 20 //Storing stroke (stores color in mode use to select color)
21 _stroke: { 21 _stroke: {
22 enumerable: false, 22 enumerable: false,
23 value: {colorMode: 'rgb', color: {r: 0, g: 0, b: 0, a: 1, css: 'rgb(0,0,0)', mode:'rgb', wasSetByCode: false, type: 'change'}, webGlColor: [0, 0, 0, 1]} 23 value: {colorMode: 'rgb', color: {r: 0, g: 0, b: 0, a: 1, css: 'rgb(0,0,0)', mode:'rgb', wasSetByCode: true, type: 'change'}, webGlColor: [0, 0, 0, 1]}
24 }, 24 },
25 //////////////////////////////////////////////////////////////////// 25 ////////////////////////////////////////////////////////////////////
26 // 26 //
@@ -39,7 +39,7 @@ exports.ColorToolbar = Montage.create(Component, {
39 //Storing fill (stores color in mode use to select color) 39 //Storing fill (stores color in mode use to select color)
40 _fill: { 40 _fill: {
41 enumerable: false, 41 enumerable: false,
42 value: {colorMode: 'rgb', color: {r: 255, g: 255, b: 255, a: 1, css: 'rgb(255,255,255)', mode:'rgb', wasSetByCode: false, type: 'change'}, webGlColor: [1, 1, 1, 1]} 42 value: {colorMode: 'rgb', color: {r: 255, g: 255, b: 255, a: 1, css: 'rgb(255,255,255)', mode:'rgb', wasSetByCode: true, type: 'change'}, webGlColor: [1, 1, 1, 1]}
43 }, 43 },
44 //////////////////////////////////////////////////////////////////// 44 ////////////////////////////////////////////////////////////////////
45 // 45 //
@@ -86,8 +86,8 @@ exports.ColorToolbar = Montage.create(Component, {
86 this.application.ninja.colorController.addButton('chip', this.fill_btn); 86 this.application.ninja.colorController.addButton('chip', this.fill_btn);
87 this.application.ninja.colorController.addButton('chip', this.stroke_btn); 87 this.application.ninja.colorController.addButton('chip', this.stroke_btn);
88 // 88 //
89 this.fill_btn.color('rgb', {wasSetByCode: false, type: 'change', color: {r: 255, g: 255, b: 255}, css: 'rgb(255,255,255)'}); 89 this.fill_btn.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 255, g: 255, b: 255}, css: 'rgb(255,255,255)'});
90 this.stroke_btn.color('rgb', {wasSetByCode: false, type: 'change', color: {r: 0, g: 0, b: 0}, css: 'rgb(0,0,0)'}); 90 this.stroke_btn.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 0, g: 0, b: 0}, css: 'rgb(0,0,0)'});
91 } 91 }
92 }, 92 },
93 //////////////////////////////////////////////////////////////////// 93 ////////////////////////////////////////////////////////////////////
diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js
index 34c38e70..0088447a 100644
--- a/js/panels/properties/content.reel/content.js
+++ b/js/panels/properties/content.reel/content.js
@@ -97,10 +97,24 @@ exports.Content = Montage.create(Component, {
97 value: function(event) { 97 value: function(event) {
98// console.log("Element Change PI ", event.detail.source); // If the event comes from the pi don't need to update 98// console.log("Element Change PI ", event.detail.source); // If the event comes from the pi don't need to update
99 if(event.detail.source && event.detail.source !== "pi") { 99 if(event.detail.source && event.detail.source !== "pi") {
100 this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "left")); 100 // TODO - This should only update the properties that were changed.
101 this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "top")); 101 var el = this.application.ninja.selectedElements[0]._element || this.application.ninja.selectedElements[0];
102 this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(el, "left"));
103 this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(el, "top"));
104 this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(el, "height"));
105 this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(el, "width"));
106
107 if(this.threeD.inGlobalMode)
108 {
109 this.threeD.x3D = ElementsMediator.get3DProperty(el, "x3D");
110 this.threeD.y3D = ElementsMediator.get3DProperty(el, "y3D");
111 this.threeD.z3D = ElementsMediator.get3DProperty(el, "z3D");
112 this.threeD.xAngle = ElementsMediator.get3DProperty(el, "xAngle");
113 this.threeD.yAngle = ElementsMediator.get3DProperty(el, "yAngle");
114 this.threeD.zAngle = ElementsMediator.get3DProperty(el, "zAngle");
102 } 115 }
103 } 116 }
117 }
104 }, 118 },
105 119
106 handleSelectionChange: { 120 handleSelectionChange: {
@@ -183,8 +197,11 @@ exports.Content = Montage.create(Component, {
183 197
184 if(control.type !== "color") { 198 if(control.type !== "color") {
185 currentValue = ElementsMediator.getProperty(el, control.prop, control.valueMutator); 199 currentValue = ElementsMediator.getProperty(el, control.prop, control.valueMutator);
186 currentValue ? currentValue = currentValue : currentValue = control.defaultValue; 200 if(currentValue === null)
187 this.customSections[0].content.controls[control.id] = currentValue; 201 {
202 currentValue = control.defaultValue;
203 }
204 this.customSections[i].content.controls[control.id] = currentValue;
188 } 205 }
189 else 206 else
190 { 207 {
@@ -198,7 +215,6 @@ exports.Content = Montage.create(Component, {
198 this.application.ninja.colorController.colorModel.input = "fill"; 215 this.application.ninja.colorController.colorModel.input = "fill";
199 } 216 }
200 217
201 debugger;
202 if(currentValue) 218 if(currentValue)
203 { 219 {
204 if(currentValue.mode === "gradient") 220 if(currentValue.mode === "gradient")
@@ -270,12 +286,6 @@ exports.Content = Montage.create(Component, {
270 286
271 e.units ? newValue = e.value + e.units : newValue = e.value; 287 e.units ? newValue = e.value + e.units : newValue = e.value;
272 288
273 if(e.prop === "border-width") {// || e.prop === "border-style") {
274 ElementsMediator.setProperty(this.application.ninja.selectedElements, "border-style", [this.customSections[0].content.controls.borderStyle], "Change", "pi");
275 } else if(e.prop === "border-style") {
276 ElementsMediator.setProperty(this.application.ninja.selectedElements, "border-width", [this.customSections[0].content.controls.borderWidth + "px"], "Change", "pi");
277 }
278
279 ElementsMediator.setProperty(this.application.ninja.selectedElements, e.prop, [newValue], "Change", "pi"); 289 ElementsMediator.setProperty(this.application.ninja.selectedElements, e.prop, [newValue], "Change", "pi");
280 290
281 } 291 }
diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js
index 2b5b522a..992db8e6 100644
--- a/js/panels/properties/sections/custom.reel/custom.js
+++ b/js/panels/properties/sections/custom.reel/custom.js
@@ -186,6 +186,8 @@ exports.CustomSection = Montage.create(Component, {
186 if (aField.value) obj.value = aField.value; 186 if (aField.value) obj.value = aField.value;
187 if (aField.labelField) obj.labelField = aField.labelField; 187 if (aField.labelField) obj.labelField = aField.labelField;
188 if (aField.labelFunction) obj.labelFunction = aField.labelFunction; 188 if (aField.labelFunction) obj.labelFunction = aField.labelFunction;
189 if (aField.dataField) obj.dataField = aField.dataField;
190 if (aField.dataFunction) obj.dataFunction = aField.dataFunction;
189 if (aField.items) { 191 if (aField.items) {
190 if(aField.items.boundObject) { 192 if(aField.items.boundObject) {
191 obj.items = eval(aField.items.boundObject)[aField.items.boundProperty]; 193 obj.items = eval(aField.items.boundObject)[aField.items.boundProperty];
@@ -193,6 +195,18 @@ exports.CustomSection = Montage.create(Component, {
193 obj.items = aField.items; 195 obj.items = aField.items;
194 } 196 }
195 } 197 }
198 if (aField.enabled) {
199 if(aField.enabled.boundObject) {
200 // TODO - For now, always bind to this.controls[someProperty]
201 Object.defineBinding(obj, "enabled", {
202 boundObject: this.controls,
203 boundObjectPropertyPath: aField.enabled.boundProperty,
204 oneway: false
205 });
206 } else {
207 obj.enabled = aField.enabled;
208 }
209 }
196 210
197 obj.addEventListener("change", this, false); 211 obj.addEventListener("change", this, false);
198// 212//