aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/sub-path.js
diff options
context:
space:
mode:
authorPushkar Joshi2012-04-18 09:47:26 -0700
committerPushkar Joshi2012-04-18 09:47:26 -0700
commit38ae1158abe94f917dbf375e73e1a9f0f68a61e8 (patch)
tree8f18fbe86a257472202ff92250737ee541b7c9cf /js/lib/geom/sub-path.js
parent5bac19550ae74bb5561d1e1fbb55bdac8c5e3dd1 (diff)
downloadninja-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/geom/sub-path.js')
-rwxr-xr-xjs/lib/geom/sub-path.js6
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]);