diff options
Diffstat (limited to 'js/lib/geom/line.js')
-rwxr-xr-x | js/lib/geom/line.js | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js index a44026eb..2b46b0f5 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 | ||
@@ -88,12 +88,12 @@ exports.Line = Object.create(GeomObj, { | |||
88 | 88 | ||
89 | if(strokeMaterial) { | 89 | if(strokeMaterial) { |
90 | this._strokeMaterial = strokeMaterial; | 90 | this._strokeMaterial = strokeMaterial; |
91 | if (strokeColor && this._strokeMaterial.hasProperty( "color" )) this._strokeMaterial.setProperty( "color", this._strokeColor ); | 91 | if (strokeColor && this._strokeMaterial.hasProperty( "color" )) this._strokeMaterial.setProperty( "color", this._strokeColor ); |
92 | } | 92 | } |
93 | } | 93 | } |
94 | }, | 94 | }, |
95 | 95 | ||
96 | //////////////////////////////////////////////////////////////////////// | 96 | //////////////////////////////////////////////////////////////////////// |
97 | // Property Accessors | 97 | // Property Accessors |
98 | /////////////////////////////////////////////////////////////////////// | 98 | /////////////////////////////////////////////////////////////////////// |
99 | // TODO - Use getters/setters in the future | 99 | // TODO - Use getters/setters in the future |
@@ -217,26 +217,26 @@ exports.Line = Object.create(GeomObj, { | |||
217 | } | 217 | } |
218 | }, | 218 | }, |
219 | 219 | ||
220 | /////////////////////////////////////////////////////////////////////// | 220 | /////////////////////////////////////////////////////////////////////// |
221 | // Methods | 221 | // Methods |
222 | /////////////////////////////////////////////////////////////////////// | 222 | /////////////////////////////////////////////////////////////////////// |
223 | exportJSON: { | 223 | exportJSON: { |
224 | value: function() { | 224 | value: function() { |
225 | var jObj = | 225 | var jObj = |
226 | { | 226 | { |
227 | 'type' : this.geomType(), | 227 | 'type' : this.geomType(), |
228 | 'xoff' : this._xOffset, | 228 | 'xoff' : this._xOffset, |
229 | 'yoff' : this._yOffset, | 229 | 'yoff' : this._yOffset, |
230 | 'width' : this._width, | 230 | 'width' : this._width, |
231 | 'height' : this._height, | 231 | 'height' : this._height, |
232 | 'xAdj' : this._xAdj, | 232 | 'xAdj' : this._xAdj, |
233 | 'yAdj' : this._yAdj, | 233 | 'yAdj' : this._yAdj, |
234 | 'slope' : this._slope, | 234 | 'slope' : this._slope, |
235 | 'strokeWidth' : this._strokeWidth, | 235 | 'strokeWidth' : this._strokeWidth, |
236 | 'strokeColor' : this._strokeColor, | 236 | 'strokeColor' : this._strokeColor, |
237 | 'strokeStyle' : this._strokeStyle, | 237 | 'strokeStyle' : this._strokeStyle, |
238 | 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : MaterialsModel.getDefaultMaterialName(), | 238 | 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : MaterialsModel.getDefaultMaterialName(), |
239 | 'materials' : this.exportMaterialsJSON() | 239 | 'materials' : this.exportMaterialsJSON() |
240 | }; | 240 | }; |
241 | 241 | ||
242 | return jObj; | 242 | return jObj; |
@@ -245,17 +245,17 @@ exports.Line = Object.create(GeomObj, { | |||
245 | 245 | ||
246 | importJSON: { | 246 | importJSON: { |
247 | value: function(jObj) { | 247 | value: function(jObj) { |
248 | this._xOffset = jObj.xoff; | 248 | this._xOffset = jObj.xoff; |
249 | this._yOffset = jObj.yoff; | 249 | this._yOffset = jObj.yoff; |
250 | this._width = jObj.width; | 250 | this._width = jObj.width; |
251 | this._height = jObj.height; | 251 | this._height = jObj.height; |
252 | this._xAdj = jObj.xAdj; | 252 | this._xAdj = jObj.xAdj; |
253 | this._yAdj = jObj.yAdj; | 253 | this._yAdj = jObj.yAdj; |
254 | this._strokeWidth = jObj.strokeWidth; | 254 | this._strokeWidth = jObj.strokeWidth; |
255 | this._slope = jObj.slope; | 255 | this._slope = jObj.slope; |
256 | this._strokeStyle = jObj.strokeStyle; | 256 | this._strokeStyle = jObj.strokeStyle; |
257 | this._strokeColor = jObj.strokeColor; | 257 | this._strokeColor = jObj.strokeColor; |
258 | var strokeMaterialName = jObj.strokeMat; | 258 | var strokeMaterialName = jObj.strokeMat; |
259 | 259 | ||
260 | var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); | 260 | var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); |
261 | if (!strokeMat) { | 261 | if (!strokeMat) { |
@@ -295,15 +295,15 @@ exports.Line = Object.create(GeomObj, { | |||
295 | 295 | ||
296 | // get the normalized device coordinates (NDC) for | 296 | // get the normalized device coordinates (NDC) for |
297 | // all position and dimensions. | 297 | // all position and dimensions. |
298 | var vpw = world.getViewportWidth(), vph = world.getViewportHeight(); | 298 | var vpw = world.getViewportWidth(), vph = world.getViewportHeight(); |
299 | var xNDC = 2*this._xOffset/vpw, yNDC = 2*this._yOffset/vph, | 299 | var xNDC = 2*this._xOffset/vpw, yNDC = 2*this._yOffset/vph, |
300 | xFillNDC = this._width/vpw, yFillNDC = this._height/vph, | 300 | xFillNDC = this._width/vpw, yFillNDC = this._height/vph, |
301 | xAdjNDC = this._xAdj/vpw, yAdjNDC = this._yAdj/vph, | 301 | xAdjNDC = this._xAdj/vpw, yAdjNDC = this._yAdj/vph, |
302 | xStrokeNDC = this._strokeWidth/vpw, yStrokeNDC = this._strokeWidth/vph; | 302 | xStrokeNDC = this._strokeWidth/vpw, yStrokeNDC = this._strokeWidth/vph; |
303 | 303 | ||
304 | var aspect = world.getAspect(); | 304 | var aspect = world.getAspect(); |
305 | var zn = world.getZNear(), zf = world.getZFar(); | 305 | var zn = world.getZNear(), zf = world.getZFar(); |
306 | var t = zn * Math.tan(world.getFOV() * Math.PI / 360.0), | 306 | var t = zn * Math.tan(world.getFOV() * Math.PI / 360.0), |
307 | b = -t, | 307 | b = -t, |
308 | r = aspect*t, | 308 | r = aspect*t, |
309 | l = -r; | 309 | l = -r; |
@@ -472,7 +472,7 @@ exports.Line = Object.create(GeomObj, { | |||
472 | cs; | 472 | cs; |
473 | 473 | ||
474 | ctx.beginPath(); | 474 | ctx.beginPath(); |
475 | ctx.lineWidth = lineWidth; | 475 | ctx.lineWidth = lineWidth; |
476 | if (this._strokeColor) { | 476 | if (this._strokeColor) { |
477 | if(this._strokeColor.gradientMode) { | 477 | if(this._strokeColor.gradientMode) { |
478 | if(this._strokeColor.gradientMode === "radial") { | 478 | if(this._strokeColor.gradientMode === "radial") { |