aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/line.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/geom/line.js')
-rwxr-xr-xjs/lib/geom/line.js70
1 files changed, 35 insertions, 35 deletions
diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js
index 6555f6ae..26631a31 100755
--- a/js/lib/geom/line.js
+++ b/js/lib/geom/line.js
@@ -45,7 +45,7 @@ exports.Line = Object.create(GeomObj, {
45 _xOffset: { value : 0, writable: true }, 45 _xOffset: { value : 0, writable: true },
46 _yOffset: { value : 0, writable: true }, 46 _yOffset: { value : 0, writable: true },
47 47
48 // If line doesn't fit in canvas world, we had to grow the canvas by this much on either side 48 // If line doesn't fit in canvas world, we had to grow the canvas by this much on either side
49 _xAdj: { value : 0, writable: true }, 49 _xAdj: { value : 0, writable: true },
50 _yAdj: { value : 0, writable: true }, 50 _yAdj: { value : 0, writable: true },
51 51
@@ -97,12 +97,12 @@ exports.Line = Object.create(GeomObj, {
97 this._strokeMaterial.setProperty( "color", this._strokeColor ); 97 this._strokeMaterial.setProperty( "color", this._strokeColor );
98 } else if (this._strokeMaterial && (this._strokeMaterial.gradientType === this._strokeColor.gradientMode)) { 98 } else if (this._strokeMaterial && (this._strokeMaterial.gradientType === this._strokeColor.gradientMode)) {
99 this._strokeMaterial.setGradientData(this._strokeColor.color); 99 this._strokeMaterial.setGradientData(this._strokeColor.color);
100 } 100 }
101 } 101 }
102 } 102 }
103 }, 103 },
104 104
105 //////////////////////////////////////////////////////////////////////// 105 ////////////////////////////////////////////////////////////////////////
106 // Property Accessors 106 // Property Accessors
107 /////////////////////////////////////////////////////////////////////// 107 ///////////////////////////////////////////////////////////////////////
108 // TODO - Use getters/setters in the future 108 // TODO - Use getters/setters in the future
@@ -226,26 +226,26 @@ exports.Line = Object.create(GeomObj, {
226 } 226 }
227 }, 227 },
228 228
229 /////////////////////////////////////////////////////////////////////// 229 ///////////////////////////////////////////////////////////////////////
230 // Methods 230 // Methods
231 /////////////////////////////////////////////////////////////////////// 231 ///////////////////////////////////////////////////////////////////////
232 exportJSON: { 232 exportJSON: {
233 value: function() { 233 value: function() {
234 var jObj = 234 var jObj =
235 { 235 {
236 'type' : this.geomType(), 236 'type' : this.geomType(),
237 'xoff' : this._xOffset, 237 'xoff' : this._xOffset,
238 'yoff' : this._yOffset, 238 'yoff' : this._yOffset,
239 'width' : this._width, 239 'width' : this._width,
240 'height' : this._height, 240 'height' : this._height,
241 'xAdj' : this._xAdj, 241 'xAdj' : this._xAdj,
242 'yAdj' : this._yAdj, 242 'yAdj' : this._yAdj,
243 'slope' : this._slope, 243 'slope' : this._slope,
244 'strokeWidth' : this._strokeWidth, 244 'strokeWidth' : this._strokeWidth,
245 'strokeColor' : this._strokeColor, 245 'strokeColor' : this._strokeColor,
246 'strokeStyle' : this._strokeStyle, 246 'strokeStyle' : this._strokeStyle,
247 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : MaterialsModel.getDefaultMaterialName(), 247 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : MaterialsModel.getDefaultMaterialName(),
248 'materials' : this.exportMaterialsJSON() 248 'materials' : this.exportMaterialsJSON()
249 }; 249 };
250 250
251 return jObj; 251 return jObj;
@@ -254,17 +254,17 @@ exports.Line = Object.create(GeomObj, {
254 254
255 importJSON: { 255 importJSON: {
256 value: function(jObj) { 256 value: function(jObj) {
257 this._xOffset = jObj.xoff; 257 this._xOffset = jObj.xoff;
258 this._yOffset = jObj.yoff; 258 this._yOffset = jObj.yoff;
259 this._width = jObj.width; 259 this._width = jObj.width;
260 this._height = jObj.height; 260 this._height = jObj.height;
261 this._xAdj = jObj.xAdj; 261 this._xAdj = jObj.xAdj;
262 this._yAdj = jObj.yAdj; 262 this._yAdj = jObj.yAdj;
263 this._strokeWidth = jObj.strokeWidth; 263 this._strokeWidth = jObj.strokeWidth;
264 this._slope = jObj.slope; 264 this._slope = jObj.slope;
265 this._strokeStyle = jObj.strokeStyle; 265 this._strokeStyle = jObj.strokeStyle;
266 this._strokeColor = jObj.strokeColor; 266 this._strokeColor = jObj.strokeColor;
267 var strokeMaterialName = jObj.strokeMat; 267 var strokeMaterialName = jObj.strokeMat;
268 268
269 var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); 269 var strokeMat = MaterialsModel.getMaterial( strokeMaterialName );
270 if (!strokeMat) { 270 if (!strokeMat) {
@@ -304,15 +304,15 @@ exports.Line = Object.create(GeomObj, {
304 304
305 // get the normalized device coordinates (NDC) for 305 // get the normalized device coordinates (NDC) for
306 // all position and dimensions. 306 // all position and dimensions.
307 var vpw = world.getViewportWidth(), vph = world.getViewportHeight(); 307 var vpw = world.getViewportWidth(), vph = world.getViewportHeight();
308 var xNDC = 2*this._xOffset/vpw, yNDC = 2*this._yOffset/vph, 308 var xNDC = 2*this._xOffset/vpw, yNDC = 2*this._yOffset/vph,
309 xFillNDC = this._width/vpw, yFillNDC = this._height/vph, 309 xFillNDC = this._width/vpw, yFillNDC = this._height/vph,
310 xAdjNDC = this._xAdj/vpw, yAdjNDC = this._yAdj/vph, 310 xAdjNDC = this._xAdj/vpw, yAdjNDC = this._yAdj/vph,
311 xStrokeNDC = this._strokeWidth/vpw, yStrokeNDC = this._strokeWidth/vph; 311 xStrokeNDC = this._strokeWidth/vpw, yStrokeNDC = this._strokeWidth/vph;
312 312
313 var aspect = world.getAspect(); 313 var aspect = world.getAspect();
314 var zn = world.getZNear(), zf = world.getZFar(); 314 var zn = world.getZNear(), zf = world.getZFar();
315 var t = zn * Math.tan(world.getFOV() * Math.PI / 360.0), 315 var t = zn * Math.tan(world.getFOV() * Math.PI / 360.0),
316 b = -t, 316 b = -t,
317 r = aspect*t, 317 r = aspect*t,
318 l = -r; 318 l = -r;
@@ -485,7 +485,7 @@ exports.Line = Object.create(GeomObj, {
485 for (var i=0; i<nPrims; i++) 485 for (var i=0; i<nPrims; i++)
486 { 486 {
487 this._primArray.push( primArray[i] ); 487 this._primArray.push( primArray[i] );
488 this._materialNodeArray.push( strokeMaterial.getMaterialNode() ); 488 this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
489 } 489 }
490 } 490 }
491 491
@@ -517,7 +517,7 @@ exports.Line = Object.create(GeomObj, {
517 cs; 517 cs;
518 518
519 ctx.beginPath(); 519 ctx.beginPath();
520 ctx.lineWidth = lineWidth; 520 ctx.lineWidth = lineWidth;
521 if (this._strokeColor) { 521 if (this._strokeColor) {
522 if(this._strokeColor.gradientMode) { 522 if(this._strokeColor.gradientMode) {
523 if(this._strokeColor.gradientMode === "radial") { 523 if(this._strokeColor.gradientMode === "radial") {