From 38ae1158abe94f917dbf375e73e1a9f0f68a61e8 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Wed, 18 Apr 2012 09:47:26 -0700 Subject: 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) --- js/lib/geom/sub-path.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'js/lib/geom/sub-path.js') 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() { } this.createSamples(false); //dirty bit checked in this function...will generate a polyline representation + var numPoints = this._Samples.length; + if (numPoints === 0){ + return; //nothing to do for empty paths + } + //figure the size of the area we will draw into var bboxWidth=0, bboxHeight=0; bboxWidth = this._BBoxMax[0] - this._BBoxMin[0]; @@ -142,7 +147,6 @@ var GLSubpath = function GLSubpath() { ctx.beginPath(); - var numPoints = this._Samples.length; ctx.moveTo(this._Samples[0][0],this._Samples[0][1]); for (var i=0;i