aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/components/converter/node-name-converter.js54
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.html6
-rwxr-xr-xjs/controllers/elements/shapes-controller.js8
-rwxr-xr-xjs/lib/geom/circle.js57
-rwxr-xr-xjs/lib/geom/geom-obj.js20
-rwxr-xr-xjs/lib/geom/line.js26
-rwxr-xr-xjs/lib/geom/rectangle.js57
-rwxr-xr-xjs/mediators/element-mediator.js9
-rwxr-xr-xjs/models/element-model.js8
-rwxr-xr-xjs/panels/Materials/materials-library-panel.reel/materials-library-panel.js20
-rwxr-xr-xjs/stage/binding-view.reel/binding-view.js2
-rwxr-xr-xjs/stage/stage.reel/stage.js4
-rwxr-xr-xjs/tools/ShapeTool.js34
13 files changed, 160 insertions, 145 deletions
diff --git a/js/components/converter/node-name-converter.js b/js/components/converter/node-name-converter.js
new file mode 100644
index 00000000..fdca06e5
--- /dev/null
+++ b/js/components/converter/node-name-converter.js
@@ -0,0 +1,54 @@
1/* <copyright>
2Copyright (c) 2012, Motorola Mobility LLC.
3All Rights Reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10
11* Redistributions in binary form must reproduce the above copyright notice,
12 this list of conditions and the following disclaimer in the documentation
13 and/or other materials provided with the distribution.
14
15* Neither the name of Motorola Mobility LLC nor the names of its
16 contributors may be used to endorse or promote products derived from this
17 software without specific prior written permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29POSSIBILITY OF SUCH DAMAGE.
30</copyright> */
31var Montage = require("montage").Montage,
32 Converter = require("montage/core/converter/converter").Converter;
33
34exports.NodeNameConverter = Montage.create(Converter, {
35
36 convert: {
37 value: function(value) {
38 if(value) {
39 if(value.toLowerCase() === "ninja-content") {
40 value = "DIV";
41 }
42
43 return value;
44 }
45 }
46 },
47
48 revert: {
49 value: function(value) {
50 return value;
51 }
52 }
53
54});
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.html b/js/components/layout/bread-crumb.reel/bread-crumb.html
index 2c6d941f..2fff245c 100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.html
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.html
@@ -44,13 +44,17 @@ POSSIBILITY OF SUCH DAMAGE.
44 } 44 }
45 }, 45 },
46 46
47 "nodeNameConverter": {
48 "prototype": "js/components/converter/node-name-converter"
49 },
50
47 "breadcrumbButton": { 51 "breadcrumbButton": {
48 "prototype": "js/components/layout/bread-crumb-button.reel", 52 "prototype": "js/components/layout/bread-crumb-button.reel",
49 "properties": { 53 "properties": {
50 "element": {"#": "breadcrumbButton"} 54 "element": {"#": "breadcrumbButton"}
51 }, 55 },
52 "bindings": { 56 "bindings": {
53 "label": {"<-": "@buttonsList.objectAtCurrentIteration.label"}, 57 "label": {"<-": "@buttonsList.objectAtCurrentIteration.label", "converter": {"@": "nodeNameConverter"}},
54 "value": {"<-": "@buttonsList.objectAtCurrentIteration.nodeUuid"} 58 "value": {"<-": "@buttonsList.objectAtCurrentIteration.nodeUuid"}
55 } 59 }
56 }, 60 },
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 1d945066..6dabff47 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -841,10 +841,10 @@ exports.ShapesController = Montage.create(CanvasController, {
841 child.strokeMat = "Linear Gradient"; 841 child.strokeMat = "Linear Gradient";
842 } 842 }
843 } 843 }
844 else if( (child.strokeMat === "Radial Gradient") || 844 else if( !child.strokeMat || (child.strokeMat === "Radial Gradient") ||
845 (child.strokeMat === "Linear Gradient") ) 845 (child.strokeMat === "Linear Gradient") )
846 { 846 {
847 // Set Flat Material for children geometry if color has been changed to solid 847 // Set Flat Material for children geometry if no material defined or color has been changed to solid
848 child.strokeMat = "Flat"; 848 child.strokeMat = "Flat";
849 } 849 }
850 } 850 }
@@ -863,10 +863,10 @@ exports.ShapesController = Montage.create(CanvasController, {
863 child.fillMat = "Linear Gradient"; 863 child.fillMat = "Linear Gradient";
864 } 864 }
865 } 865 }
866 else if( (child.fillMat === "Radial Gradient") || 866 else if( !child.fillMat || (child.fillMat === "Radial Gradient") ||
867 (child.fillMat === "Linear Gradient") ) 867 (child.fillMat === "Linear Gradient") )
868 { 868 {
869 // Set Flat Material for children geometry if color has been changed to solid 869 // Set Flat Material for children geometry if no material defined or color has been changed to solid
870 child.fillMat = "Flat"; 870 child.fillMat = "Flat";
871 } 871 }
872 } 872 }
diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js
index ba47603b..4995c2cb 100755
--- a/js/lib/geom/circle.js
+++ b/js/lib/geom/circle.js
@@ -83,31 +83,13 @@ exports.Circle = Object.create(GeomObj, {
83 83
84 if(strokeMaterial) { 84 if(strokeMaterial) {
85 this._strokeMaterial = strokeMaterial.dup(); 85 this._strokeMaterial = strokeMaterial.dup();
86 } else {
87 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup();
88 }
89
90 if(strokeColor) {
91 if(this._strokeMaterial.hasProperty("color")) {
92 this._strokeMaterial.setProperty( "color", this._strokeColor );
93 } else if (this._strokeMaterial && (this._strokeMaterial.gradientType === this._strokeColor.gradientMode)) {
94 this._strokeMaterial.setGradientData(this._strokeColor.color);
95 }
96 } 86 }
97 87
98 if(fillMaterial) { 88 if(fillMaterial) {
99 this._fillMaterial = fillMaterial.dup(); 89 this._fillMaterial = fillMaterial.dup();
100 } else {
101 this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup();
102 } 90 }
103 91
104 if(fillColor) { 92 this.initColors();
105 if(this._fillMaterial.hasProperty("color")) {
106 this._fillMaterial.setProperty( "color", this._fillColor );
107 } else if (this._fillMaterial && (this._fillMaterial.gradientType === this._fillColor.gradientMode)) {
108 this._fillMaterial.setGradientData(this._fillColor.color);
109 }
110 }
111 } 93 }
112 }, 94 },
113 95
@@ -770,8 +752,8 @@ exports.Circle = Object.create(GeomObj, {
770 'fillColor' : this._fillColor, 752 'fillColor' : this._fillColor,
771 'innerRadius' : this._innerRadius, 753 'innerRadius' : this._innerRadius,
772 'strokeStyle' : this._strokeStyle, 754 'strokeStyle' : this._strokeStyle,
773 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : MaterialsModel.getDefaultMaterialName(), 755 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : null,
774 'fillMat' : this._fillMaterial ? this._fillMaterial.getName() : MaterialsModel.getDefaultMaterialName(), 756 'fillMat' : this._fillMaterial ? this._fillMaterial.getName() : null,
775 'materials' : this.exportMaterialsJSON() 757 'materials' : this.exportMaterialsJSON()
776 }; 758 };
777 759
@@ -790,27 +772,26 @@ exports.Circle = Object.create(GeomObj, {
790 this._fillColor = jObj.fillColor; 772 this._fillColor = jObj.fillColor;
791 this._innerRadius = jObj.innerRadius; 773 this._innerRadius = jObj.innerRadius;
792 this._strokeStyle = jObj.strokeStyle; 774 this._strokeStyle = jObj.strokeStyle;
793 var strokeMaterialName = jObj.strokeMat;
794 var fillMaterialName = jObj.fillMat;
795 775
796 var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ).dup(); 776 if(jObj.strokeMat) {
797 if (!strokeMat) { 777 var strokeMat = MaterialsModel.getMaterial(jObj.strokeMat).dup();
798 console.log( "object material not found in library: " + strokeMaterialName ); 778 if (!strokeMat) {
799 strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); 779 console.log("object material not found in library: " + jObj.strokeMat);
780 } else {
781 this._strokeMaterial = strokeMat;
782 }
800 } 783 }
801 this._strokeMaterial = strokeMat; 784
802 if (this._strokeMaterial.hasProperty( 'color' )) 785 if(jObj.fillMat) {
803 this._strokeMaterial.setProperty( 'color', this._strokeColor ); 786 var fillMat = MaterialsModel.getMaterial(jObj.fillMat).dup();
804 787 if (!fillMat) {
805 var fillMat = MaterialsModel.getMaterial( fillMaterialName ).dup(); 788 console.log("object material not