diff options
author | Pushkar Joshi | 2012-04-18 09:47:26 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-04-18 09:47:26 -0700 |
commit | 38ae1158abe94f917dbf375e73e1a9f0f68a61e8 (patch) | |
tree | 8f18fbe86a257472202ff92250737ee541b7c9cf /js/lib | |
parent | 5bac19550ae74bb5561d1e1fbb55bdac8c5e3dd1 (diff) | |
download | ninja-38ae1158abe94f917dbf375e73e1a9f0f68a61e8.tar.gz |
allow drawing polylines in YZ and XZ planes as well as XY. In those planes, still have bug with shift when the bbox of the path grows (due to missing translation)
Diffstat (limited to 'js/lib')
-rwxr-xr-x | js/lib/geom/sub-path.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/js/lib/geom/sub-path.js b/js/lib/geom/sub-path.js index 7e11bb33..2ecafa1c 100755 --- a/js/lib/geom/sub-path.js +++ b/js/lib/geom/sub-path.js | |||
@@ -95,6 +95,11 @@ var GLSubpath = function GLSubpath() { | |||
95 | } | 95 | } |
96 | this.createSamples(false); //dirty bit checked in this function...will generate a polyline representation | 96 | this.createSamples(false); //dirty bit checked in this function...will generate a polyline representation |
97 | 97 | ||
98 | var numPoints = this._Samples.length; | ||
99 | if (numPoints === 0){ | ||
100 | return; //nothing to do for empty paths | ||
101 | } | ||
102 | |||
98 | //figure the size of the area we will draw into | 103 | //figure the size of the area we will draw into |
99 | var bboxWidth=0, bboxHeight=0; | 104 | var bboxWidth=0, bboxHeight=0; |
100 | bboxWidth = this._BBoxMax[0] - this._BBoxMin[0]; | 105 | bboxWidth = this._BBoxMax[0] - this._BBoxMin[0]; |
@@ -142,7 +147,6 @@ var GLSubpath = function GLSubpath() { | |||
142 | 147 | ||
143 | 148 | ||
144 | ctx.beginPath(); | 149 | ctx.beginPath(); |
145 | var numPoints = this._Samples.length; | ||
146 | ctx.moveTo(this._Samples[0][0],this._Samples[0][1]); | 150 | ctx.moveTo(this._Samples[0][0],this._Samples[0][1]); |
147 | for (var i=0;i<numPoints;i++){ | 151 | for (var i=0;i<numPoints;i++){ |
148 | ctx.lineTo(this._Samples[i][0],this._Samples[i][1]); | 152 | ctx.lineTo(this._Samples[i][0],this._Samples[i][1]); |