diff options
author | Valerio Virgillito | 2012-07-20 15:45:23 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-20 15:45:23 -0700 |
commit | a9b17cef34d3c4f222b6f4d0949fa3c2bbfe867b (patch) | |
tree | 5adb6c7c4bf4e13c70379050627ad6d42a7a86e6 /js/lib/geom/line.js | |
parent | 288b81e06db68b785524db5c7f7ae1ecbc3d83b1 (diff) | |
parent | d7f5d6ffb39d55f2d4f4f366421571826df1e8bb (diff) | |
download | ninja-a9b17cef34d3c4f222b6f4d0949fa3c2bbfe867b.tar.gz |
Merge branch 'Fixes_071' of https://github.com/mqg734/ninja
Diffstat (limited to 'js/lib/geom/line.js')
-rwxr-xr-x | js/lib/geom/line.js | 26 |
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 | }, |