aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/line.js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-07-19 16:26:03 -0700
committerNivesh Rajbhandari2012-07-19 16:26:03 -0700
commit4648e2eda9aa8c8f9b0aed4d12fef8b1d00f1769 (patch)
treec35f028b13e8800291f9d8e005752d8ad5d3d8be /js/lib/geom/line.js
parent6db7685f40310683e1cb6c4e98895d2007e787dc (diff)
downloadninja-4648e2eda9aa8c8f9b0aed4d12fef8b1d00f1769.tar.gz
IKNINJA-1780 - [Shape] Error when opening document that contains a shape with gradient color or no color.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/lib/geom/line.js')
-rwxr-xr-xjs/lib/geom/line.js26
1 files changed, 10 insertions, 16 deletions
diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js
index c0322f46..eec4f6d9 100755
--- a/js/lib/geom/line.js
+++ b/js/lib/geom/line.js
@@ -89,17 +89,9 @@ exports.Line = Object.create(GeomObj, {
89 89
90 if(strokeMaterial) { 90 if(strokeMaterial) {
91 this._strokeMaterial = strokeMaterial.dup(); 91 this._strokeMaterial = strokeMaterial.dup();
92 } else {
93 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup();
94 } 92 }
95 93
96 if(strokeColor) { 94 this.initColors();
97 if(this._strokeMaterial.hasProperty("color")) {
98 this._strokeMaterial.setProperty( "color", this._strokeColor );
99 } else if (this._strokeMaterial && (this._strokeMaterial.gradientType === this._strokeColor.gradientMode)) {
100 this._strokeMaterial.setGradientData(this._strokeColor.color);
101 }
102 }
103 } 95 }
104 }, 96 },
105 97
@@ -245,7 +237,7 @@ exports.Line = Object.create(GeomObj, {
245 'strokeWidth' : this._strokeWidth, 237 'strokeWidth' : this._strokeWidth,
246 'strokeColor' : this._strokeColor, 238 'strokeColor' : this._strokeColor,
247 'strokeStyle' : this._strokeStyle, 239 'strokeStyle' : this._strokeStyle,
248 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : MaterialsModel.getDefaultMaterialName(), 240 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : null,
249 'materials' : this.exportMaterialsJSON() 241 'materials' : this.exportMaterialsJSON()
250 }; 242 };
251 243
@@ -265,15 +257,17 @@ exports.Line = Object.create(GeomObj, {
265 this._slope = jObj.slope; 257 this._slope = jObj.slope;
266 this._strokeStyle = jObj.strokeStyle; 258 this._strokeStyle = jObj.strokeStyle;
267 this._strokeColor = jObj.strokeColor; 259 this._strokeColor = jObj.strokeColor;
268 var strokeMaterialName = jObj.strokeMat;
269 260
270 var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); 261 if(jObj.strokeMat) {
271 if (!strokeMat) { 262 var strokeMat = MaterialsModel.getMaterial(jObj.strokeMat).dup();
272 console.log( "object material not found in library: " + strokeMaterialName ); 263 if (!strokeMat) {
273 strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); 264 console.log("object material not found in library: " + jObj.strokeMat);
265 } else {
266 this._strokeMaterial = strokeMat;
267 }
274 } 268 }
275 this._strokeMaterial = strokeMat;
276 269
270 this.initColors();
277 this.importMaterialsJSON( jObj.materials ); 271 this.importMaterialsJSON( jObj.materials );
278 } 272 }
279 }, 273 },