diff options
-rwxr-xr-x | js/helper-classes/RDGE/GLBrushStroke.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/js/helper-classes/RDGE/GLBrushStroke.js b/js/helper-classes/RDGE/GLBrushStroke.js index 07a4a039..5d773c2d 100755 --- a/js/helper-classes/RDGE/GLBrushStroke.js +++ b/js/helper-classes/RDGE/GLBrushStroke.js | |||
@@ -38,6 +38,9 @@ function GLBrushStroke() { | |||
38 | //smaller value means more samples for the path | 38 | //smaller value means more samples for the path |
39 | this._WETNESS_FACTOR = 0.25; | 39 | this._WETNESS_FACTOR = 0.25; |
40 | 40 | ||
41 | //prevent extremely long paths that can take a long time to render | ||
42 | this._MAX_ALLOWED_SAMPLES = 500; | ||
43 | |||
41 | //drawing context | 44 | //drawing context |
42 | this._world = null; | 45 | this._world = null; |
43 | 46 | ||
@@ -159,6 +162,12 @@ function GLBrushStroke() { | |||
159 | prevPt=pt; | 162 | prevPt=pt; |
160 | //update numPoints to match the new length | 163 | //update numPoints to match the new length |
161 | numPoints = this._Points.length; | 164 | numPoints = this._Points.length; |
165 | |||
166 | //end this function if the numPoints has gone above the max. size specified | ||
167 | if (numPoints> this._MAX_ALLOWED_SAMPLES){ | ||
168 | console.log("leaving the resampling because numPoints is greater than limit:"+this._MAX_ALLOWED_SAMPLES); | ||
169 | break; | ||
170 | } | ||
162 | } | 171 | } |
163 | } | 172 | } |
164 | 173 | ||