aboutsummaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib')
-rwxr-xr-xjs/lib/geom/geom-obj.js39
1 files changed, 20 insertions, 19 deletions
diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js
index 726c3595..1ea74475 100755
--- a/js/lib/geom/geom-obj.js
+++ b/js/lib/geom/geom-obj.js
@@ -138,8 +138,10 @@ var GeomObj = function GLGeomObj() {
138 // Methods 138 // Methods
139 /////////////////////////////////////////////////////////////////////// 139 ///////////////////////////////////////////////////////////////////////
140 this.setMaterialColor = function(c, type) { 140 this.setMaterialColor = function(c, type) {
141 var i = 0,
142 nMats = 0;
141 if(c.gradientMode) { 143 if(c.gradientMode) {
142 var nMats = 0; 144 // Gradient support
143 if (this._materialArray && this._materialTypeArray) { 145 if (this._materialArray && this._materialTypeArray) {
144 nMats = this._materialArray.length; 146 nMats = this._materialArray.length;
145 } 147 }
@@ -160,7 +162,7 @@ var GeomObj = function GLGeomObj() {
160 stops.push(stop); 162 stops.push(stop);
161 163
162 if (nMats === this._materialTypeArray.length) { 164 if (nMats === this._materialTypeArray.length) {
163 for (var i=0; i<nMats; i++) { 165 for (i=0; i<nMats; i++) {
164 if (this._materialTypeArray[i] == type) { 166 if (this._materialTypeArray[i] == type) {
165 this._materialArray[i].setProperty( "color"+(n+1), stop.slice(0) ); 167 this._materialArray[i].setProperty( "color"+(n+1), stop.slice(0) );
166 this._materialArray[i].setProperty( "colorStop"+(n+1), position ); 168 this._materialArray[i].setProperty( "colorStop"+(n+1), position );
@@ -168,22 +170,22 @@ var GeomObj = function GLGeomObj() {
168 } 170 }
169 } 171 }
170 } 172 }
171// if (type == "fill") { 173 if (type === "fill") {
172// this._fillColor = c.slice(0); 174 this._fillColor = c;
173// } else { 175 } else {
174// this._strokeColor = c.slice(0); 176 this._strokeColor = c;
175// } 177 }
176 } else { 178 } else {
177 if (type == "fill") { 179 if (type === "fill") {
178 this._fillColor = c.slice(0); 180 this._fillColor = c.slice(0);
179 } else { 181 } else {
180 this._strokeColor = c.slice(0); 182 this._strokeColor = c.slice(0);
181 } 183 }
182 184
183 if (this._materialArray && this._materialTypeArray) { 185 if (this._materialArray && this._materialTypeArray) {
184 var nMats = this._materialArray.length; 186 nMats = this._materialArray.length;
185 if (nMats === this._materialTypeArray.length) { 187 if (nMats === this._materialTypeArray.length) {
186 for (var i=0; i<nMats; i++) { 188 for (i=0; i<nMats; i++) {
187 if (this._materialTypeArray[i] == type) { 189 if (this._materialTypeArray[i] == type) {
188 this._materialArray[i].setProperty( "color", c.slice(0) ); 190 this._materialArray[i].setProperty( "color", c.slice(0) );
189 } 191 }
@@ -192,8 +194,6 @@ var GeomObj = function GLGeomObj() {
192 } 194 }
193 } 195 }
194 196
195
196
197 var world = this.getWorld(); 197 var world = this.getWorld();
198 if (world) { 198 if (world) {
199 world.restartRenderLoop(); 199 world.restartRenderLoop();
@@ -210,14 +210,15 @@ var GeomObj = function GLGeomObj() {
210 210
211 if (strokeMaterial) { 211 if (strokeMaterial) {
212 strokeMaterial.init( this.getWorld() ); 212 strokeMaterial.init( this.getWorld() );
213 if(this._strokeColor) {
214 strokeMaterial.setProperty("color", this._strokeColor);
215 }
216 } 213 }
217 214
218 this._materialArray.push( strokeMaterial ); 215 this._materialArray.push( strokeMaterial );
219 this._materialTypeArray.push( "stroke" ); 216 this._materialTypeArray.push( "stroke" );
220 217
218 if(this._strokeColor) {
219 this.setStrokeColor(this._strokeColor);
220 }
221
221 return strokeMaterial; 222 return strokeMaterial;
222 }; 223 };
223 224
@@ -231,15 +232,15 @@ var GeomObj = function GLGeomObj() {
231 232
232 if (fillMaterial) { 233 if (fillMaterial) {
233 fillMaterial.init( this.getWorld() ); 234 fillMaterial.init( this.getWorld() );
234 //if(!this.getFillMaterial() && this._fillColor)
235 if (this._fillColor) {
236 fillMaterial.setProperty("color", this._fillColor);
237 }
238 } 235 }
239 236
240 this._materialArray.push( fillMaterial ); 237 this._materialArray.push( fillMaterial );
241 this._materialTypeArray.push( "fill" ); 238 this._materialTypeArray.push( "fill" );
242 239
240 if (this._fillColor) {
241 this.setFillColor(this._fillColor);
242 }
243
243 return fillMaterial; 244 return fillMaterial;
244 }; 245 };
245 246