aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-07 10:58:14 -0800
committerNivesh Rajbhandari2012-02-07 10:58:14 -0800
commit486842239c71e7964f38a09aacda4970f2a82e1a (patch)
tree20a6688d296b1ef09bf32add9dfdef586bfe4207 /js
parent789eaf5a92c903f27462c69a8890fbec695ab14e (diff)
downloadninja-486842239c71e7964f38a09aacda4970f2a82e1a.tar.gz
Updated tools and PI to get/set materials by binding to appModel's materials property. This requires us to add FlatMaterial to the list of materials in the MaterialsLibrary.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--js/components/combobox.reel/combobox.js22
-rw-r--r--js/components/tools-properties/fill-properties.reel/fill-properties.html11
-rw-r--r--js/components/tools-properties/fill-properties.reel/fill-properties.js6
-rw-r--r--js/components/tools-properties/ink-bottle-properties.reel/ink-bottle-properties.html12
-rw-r--r--js/components/tools-properties/ink-bottle-properties.reel/ink-bottle-properties.js6
-rw-r--r--js/components/tools-properties/line-properties.reel/line-properties.js14
-rw-r--r--js/components/tools-properties/oval-properties.reel/oval-properties.js14
-rw-r--r--js/components/tools-properties/rect-properties.reel/rect-properties.js14
-rw-r--r--js/components/tools-properties/shape-properties.reel/shape-properties.css6
-rw-r--r--js/components/tools-properties/shape-properties.reel/shape-properties.html35
-rw-r--r--js/components/tools-properties/shape-properties.reel/shape-properties.js53
-rw-r--r--js/data/pi/pi-data.js2
-rw-r--r--js/helper-classes/RDGE/MaterialsLibrary.js2
-rw-r--r--js/models/shape-model.js2
-rw-r--r--js/tools/LineTool.js7
-rw-r--r--js/tools/OvalTool.js14
-rw-r--r--js/tools/RectTool.js14
17 files changed, 155 insertions, 79 deletions
diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js
index deef2a47..8906a649 100644
--- a/js/components/combobox.reel/combobox.js
+++ b/js/components/combobox.reel/combobox.js
@@ -27,6 +27,14 @@ exports.Combobox = Montage.create(Component, {
27 value: null 27 value: null
28 }, 28 },
29 29
30 dataField: {
31 value: null
32 },
33
34 dataFunction: {
35 value: null
36 },
37
30 _items: { 38 _items: {
31 value: [] 39 value: []
32 }, 40 },
@@ -122,7 +130,19 @@ exports.Combobox = Montage.create(Component, {
122 { 130 {
123 var current = items[i]; 131 var current = items[i];
124 optionItem = document.createElement("option"); 132 optionItem = document.createElement("option");
125 optionItem.value = current; 133 if(this.dataFunction)
134 {
135 optionItem.value = this.dataFunction(current);
136 }
137 else if(this.dataField)
138 {
139 optionItem.value = current[this.dataField];
140 }
141 else
142 {
143 optionItem.value = current;
144 }
145
126 if(this.labelFunction) 146 if(this.labelFunction)
127 { 147 {
128 optionItem.innerText = this.labelFunction(current); 148 optionItem.innerText = this.labelFunction(current);
diff --git a/js/components/tools-properties/fill-properties.reel/fill-properties.html b/js/components/tools-properties/fill-properties.reel/fill-properties.html
index d09b7f44..a35f9b15 100644
--- a/js/components/tools-properties/fill-properties.reel/fill-properties.html
+++ b/js/components/tools-properties/fill-properties.reel/fill-properties.html
@@ -11,6 +11,15 @@
11 11
12 <script type="text/montage-serialization"> 12 <script type="text/montage-serialization">
13 { 13 {
14 "_fillMaterialCB": {
15 "module": "js/components/combobox.reel",
16 "name": "Combobox",
17 "properties": {
18 "element": {"#": "fillMaterialCB"},
19 "labelField": "_name",
20 "dataField": "_name"
21 }
22 },
14 "owner": { 23 "owner": {
15 "module": "js/components/tools-properties/fill-properties.reel", 24 "module": "js/components/tools-properties/fill-properties.reel",
16 "name": "FillProperties", 25 "name": "FillProperties",
@@ -18,7 +27,7 @@
18 "element": {"#": "fillProperties"}, 27 "element": {"#": "fillProperties"},
19 "_useWebGL": {"#": "useWebGLCH"}, 28 "_useWebGL": {"#": "useWebGLCH"},
20 "_materialsContainer": {"#": "materialsContainer"}, 29 "_materialsContainer": {"#": "materialsContainer"},
21 "_fillMaterial": {"#": "fillMaterialCB"} 30 "_fillMaterial": {"@": "_fillMaterialCB"}
22 } 31 }
23 } 32 }
24 } 33 }
diff --git a/js/components/tools-properties/fill-properties.reel/fill-properties.js b/js/components/tools-properties/fill-properties.reel/fill-properties.js
index 3b77d72e..61b667d7 100644
--- a/js/components/tools-properties/fill-properties.reel/fill-properties.js
+++ b/js/components/tools-properties/fill-properties.reel/fill-properties.js
@@ -14,7 +14,11 @@ exports.FillProperties = Montage.create(ToolProperties, {
14 14
15 _subPrepare: { 15 _subPrepare: {
16 value: function() { 16 value: function() {
17 ShapesController.DisplayMaterials(this._fillMaterial); 17 Object.defineBinding(this._fillMaterial, "items", {
18 boundObject: this.application.ninja.appModel,
19 boundObjectPropertyPath: "materials",
20 oneway: false
21 });
18 22
19 this.handleChange(null); 23 this.handleChange(null);
20 this._useWebGL.addEventListener("change", this, false); 24 this._useWebGL.addEventListener("change", this, false);
diff --git a/js/components/tools-properties/ink-bottle-properties.reel/ink-bottle-properties.html b/js/components/tools-properties/ink-bottle-properties.reel/ink-bottle-properties.html
index b98a7b4c..1602e793 100644
--- a/js/components/tools-properties/ink-bottle-properties.reel/ink-bottle-properties.html
+++ b/js/components/tools-properties/ink-bottle-properties.reel/ink-bottle-properties.html
@@ -36,6 +36,16 @@
36 } 36 }
37 }, 37 },
38 38
39 "_strokeMaterialCB": {
40 "module": "js/components/combobox.reel",
41 "name": "Combobox",
42 "properties": {
43 "element": {"#": "strokeMaterialIBCB"},
44 "labelField": "_name",
45 "dataField": "_name"
46 }
47 },
48
39 "owner": { 49 "owner": {
40 "module": "js/components/tools-properties/ink-bottle-properties.reel", 50 "module": "js/components/tools-properties/ink-bottle-properties.reel",
41 "name": "InkBottleProperties", 51 "name": "InkBottleProperties",
@@ -49,7 +59,7 @@
49 59
50 "_useWebGL": {"#": "useWebGLCHIB"}, 60 "_useWebGL": {"#": "useWebGLCHIB"},
51 "_materialsContainer": {"#": "materialsContainerIB"}, 61 "_materialsContainer": {"#": "materialsContainerIB"},
52 "_strokeMaterial": {"#": "strokeMaterialIBCB"} 62 "_strokeMaterial": {"@": "_strokeMaterialCB"}
53 } 63 }
54 } 64 }
55 } 65 }
diff --git a/js/components/tools-properties/ink-bottle-properties.reel/ink-bottle-properties.js b/js/components/tools-properties/ink-bottle-properties.reel/ink-bottle-properties.js
index 61ea808a..e3ffc359 100644
--- a/js/components/tools-properties/ink-bottle-properties.reel/ink-bottle-properties.js
+++ b/js/components/tools-properties/ink-bottle-properties.reel/ink-bottle-properties.js
@@ -14,7 +14,11 @@ exports.InkBottleProperties = Montage.create(ToolProperties, {
14 14
15 _subPrepare: { 15 _subPrepare: {
16 value: function() { 16 value: function() {
17 ShapesController.DisplayMaterials(this._strokeMaterial); 17 Object.defineBinding(this._strokeMaterial, "items", {
18 boundObject: this.application.ninja.appModel,
19 boundObjectPropertyPath: "materials",
20 oneway: false
21 });
18 22
19 this.handleChange(null); 23 this.handleChange(null);
20 this._useWebGL.addEventListener("change", this, false); 24 this._useWebGL.addEventListener("change", this, false);
diff --git a/js/components/tools-properties/line-properties.reel/line-properties.js b/js/components/tools-properties/line-properties.reel/line-properties.js
index 694e4326..e1ecf790 100644
--- a/js/components/tools-properties/line-properties.reel/line-properties.js
+++ b/js/components/tools-properties/line-properties.reel/line-properties.js
@@ -33,18 +33,24 @@ exports.LineProperties = Montage.create(ToolProperties, {
33 }, 33 },
34 34
35 strokeStyle : { 35 strokeStyle : {
36 get: function() { return this.base._strokeStyle.options[this.base._strokeStyle.value].text; } 36 get: function() {
37// return this.base._strokeStyle.options[this.base._strokeStyle.value].text;
38 return "Solid";
39 }
37 }, 40 },
38 41
39 strokeStyleIndex : { 42 strokeStyleIndex : {
40 get: function() { return this.base._strokeStyle.options[this.base._strokeStyle.value].value; } 43 get: function() {
44// return this.base._strokeStyle.options[this.base._strokeStyle.value].value;
45 return 1;
46 }
41 }, 47 },
42 48
43 strokeMaterial: { 49 strokeMaterial: {
44 get: function() { return this.base._strokeMaterial.options[this.base._strokeMaterial.value].value; } 50 get: function() { return this.base._strokeMaterial.value; }
45 }, 51 },
46 52
47 fillMaterial: { 53 fillMaterial: {
48 get: function() { return this.base._fillMaterial.options[this.base._fillMaterial.value].value;