From 486842239c71e7964f38a09aacda4970f2a82e1a Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 7 Feb 2012 10:58:14 -0800 Subject: 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 --- .../shape-properties.reel/shape-properties.css | 6 +-- .../shape-properties.reel/shape-properties.html | 35 +++++++++----- .../shape-properties.reel/shape-properties.js | 53 +++++++++++++--------- 3 files changed, 55 insertions(+), 39 deletions(-) (limited to 'js/components/tools-properties/shape-properties.reel') diff --git a/js/components/tools-properties/shape-properties.reel/shape-properties.css b/js/components/tools-properties/shape-properties.reel/shape-properties.css index 1e36b0bd..0441c1cf 100644 --- a/js/components/tools-properties/shape-properties.reel/shape-properties.css +++ b/js/components/tools-properties/shape-properties.reel/shape-properties.css @@ -2,8 +2,4 @@ This file contains proprietary software owned by Motorola Mobility, Inc.
No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. - */ - -#strokeIcon { - float: left; -} \ No newline at end of file + */ \ No newline at end of file diff --git a/js/components/tools-properties/shape-properties.reel/shape-properties.html b/js/components/tools-properties/shape-properties.reel/shape-properties.html index 52502d47..64840b17 100644 --- a/js/components/tools-properties/shape-properties.reel/shape-properties.html +++ b/js/components/tools-properties/shape-properties.reel/shape-properties.html @@ -53,6 +53,26 @@ } }, + "_strokeMaterial1": { + "module": "js/components/combobox.reel", + "name": "Combobox", + "properties": { + "element": {"#": "strokeMaterialCB"}, + "labelField": "_name", + "dataField": "_name" + } + }, + + "_fillMaterial1": { + "module": "js/components/combobox.reel", + "name": "Combobox", + "properties": { + "element": {"#": "fillMaterialCB"}, + "labelField": "_name", + "dataField": "_name" + } + }, + "toolbutton1": { "module": "js/components/layout/subtool-button.reel", "name": "SubToolButton", @@ -89,10 +109,9 @@ "name": "ShapeProperties", "properties": { "element": {"#": "shapeProperties"}, - "_strokeStyle": {"#": "strokeStyleCB"}, - "_strokeMaterial": {"#": "strokeMaterialCB"}, + "_strokeMaterial": {"@": "_strokeMaterial1"}, "_fillIcon": {"#": "fillIcon"}, - "_fillMaterial": {"#": "fillMaterialCB"}, + "_fillMaterial": {"@": "_fillMaterial1"}, "_useWebGL": {"#": "useWebGLCH"}, "_materialLabel": {"#": "materialLabel"}, @@ -125,14 +144,6 @@
- - -
@@ -142,7 +153,7 @@ -
+
diff --git a/js/components/tools-properties/shape-properties.reel/shape-properties.js b/js/components/tools-properties/shape-properties.reel/shape-properties.js index b0d674cc..345e361c 100644 --- a/js/components/tools-properties/shape-properties.reel/shape-properties.js +++ b/js/components/tools-properties/shape-properties.reel/shape-properties.js @@ -16,8 +16,17 @@ exports.ShapeProperties = Montage.create(ToolProperties, { value: function() { this.rectProperties.visible = true; - ShapesController.DisplayMaterials(this._strokeMaterial); - ShapesController.DisplayMaterials(this._fillMaterial); + Object.defineBinding(this._strokeMaterial, "items", { + boundObject: this.application.ninja.appModel, + boundObjectPropertyPath: "materials", + oneway: false + }); + + Object.defineBinding(this._fillMaterial, "items", { + boundObject: this.application.ninja.appModel, + boundObjectPropertyPath: "materials", + oneway: false + }); this.handleChange(null); this._useWebGL.addEventListener("change", this, false); @@ -36,13 +45,13 @@ exports.ShapeProperties = Montage.create(ToolProperties, { this._selectedSubTool = value; this[this._selectedSubTool.properties].visible = true; - if(this._selectedSubTool.id === "LineTool") { - this._fillIcon.style["display"] = "none"; - this._fillMaterial.style["display"] = "none"; - } else { - this._fillIcon.style["display"] = ""; - this._fillMaterial.style["display"] = ""; - } +// if(this._selectedSubTool.id === "LineTool") { +// this._fillIcon.style["display"] = "none"; +// this._fillMaterial.style["display"] = "none"; +// } else { +// this._fillIcon.style["display"] = ""; +// this._fillMaterial.style["display"] = ""; +// } } } @@ -53,23 +62,23 @@ exports.ShapeProperties = Montage.create(ToolProperties, { if(this._useWebGL.checked) { this._use3D = true; - this._materialLabel.style["display"] = ""; - this._strokeIcon.style["display"] = ""; - this._strokeMaterial.style["display"] = ""; - if(this.selectedSubTool.id !== "LineTool") - { - this._fillIcon.style["display"] = ""; - this._fillMaterial.style["display"] = ""; - } +// this._materialLabel.style["display"] = ""; +// this._strokeIcon.style["display"] = ""; +// this._strokeMaterial.style["display"] = ""; +// if(this.selectedSubTool.id !== "LineTool") +// { +// this._fillIcon.style["display"] = ""; +// this._fillMaterial.style["display"] = ""; +// } } else { this._use3D = false; - this._materialLabel.style["display"] = "none"; - this._strokeIcon.style["display"] = "none"; - this._strokeMaterial.style["display"] = "none"; - this._fillIcon.style["display"] = "none"; - this._fillMaterial.style["display"] = "none"; +// this._materialLabel.style["display"] = "none"; +// this._strokeIcon.style["display"] = "none"; +// this._strokeMaterial.style["display"] = "none"; +// this._fillIcon.style["display"] = "none"; +// this._fillMaterial.style["display"] = "none"; } } } -- cgit v1.2.3 From 329a859e2666716c3a1d99c6bd2679e10c81fc8d Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 7 Feb 2012 15:25:11 -0800 Subject: Added ability to toggle combobox's visibility so we can show/hide materials comboboxes in the tool options. Signed-off-by: Nivesh Rajbhandari --- .../shape-properties.reel/shape-properties.js | 43 ++++++++++++---------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'js/components/tools-properties/shape-properties.reel') diff --git a/js/components/tools-properties/shape-properties.reel/shape-properties.js b/js/components/tools-properties/shape-properties.reel/shape-properties.js index 345e361c..79567453 100644 --- a/js/components/tools-properties/shape-properties.reel/shape-properties.js +++ b/js/components/tools-properties/shape-properties.reel/shape-properties.js @@ -45,13 +45,16 @@ exports.ShapeProperties = Montage.create(ToolProperties, { this._selectedSubTool = value; this[this._selectedSubTool.properties].visible = true; -// if(this._selectedSubTool.id === "LineTool") { -// this._fillIcon.style["display"] = "none"; -// this._fillMaterial.style["display"] = "none"; -// } else { -// this._fillIcon.style["display"] = ""; -// this._fillMaterial.style["display"] = ""; -// } + if(this._useWebGL.checked) + { + if(this._selectedSubTool.id === "LineTool") { + this._fillIcon.style["display"] = "none"; + this._fillMaterial.visible = false; + } else { + this._fillIcon.style["display"] = ""; + this._fillMaterial.visible = true; + } + } } } @@ -62,23 +65,23 @@ exports.ShapeProperties = Montage.create(ToolProperties, { if(this._useWebGL.checked) { this._use3D = true; -// this._materialLabel.style["display"] = ""; -// this._strokeIcon.style["display"] = ""; -// this._strokeMaterial.style["display"] = ""; -// if(this.selectedSubTool.id !== "LineTool") -// { -// this._fillIcon.style["display"] = ""; -// this._fillMaterial.style["display"] = ""; -// } + this._materialLabel.style["display"] = ""; + this._strokeIcon.style["display"] = ""; + this._strokeMaterial.visible = true; + if(this.selectedSubTool.id !== "LineTool") + { + this._fillIcon.style["display"] = ""; + this._fillMaterial.visible = true; + } } else { this._use3D = false; -// this._materialLabel.style["display"] = "none"; -// this._strokeIcon.style["display"] = "none"; -// this._strokeMaterial.style["display"] = "none"; -// this._fillIcon.style["display"] = "none"; -// this._fillMaterial.style["display"] = "none"; + this._materialLabel.style["display"] = "none"; + this._strokeIcon.style["display"] = "none"; + this._strokeMaterial.visible = false; + this._fillIcon.style["display"] = "none"; + this._fillMaterial.visible = false; } } } -- cgit v1.2.3