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.js | 53 +++++++++++++--------- 1 file changed, 31 insertions(+), 22 deletions(-) (limited to 'js/components/tools-properties/shape-properties.reel/shape-properties.js') 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/shape-properties.js') 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