aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorPushkar Joshi2012-03-19 11:05:05 -0700
committerPushkar Joshi2012-03-19 11:05:05 -0700
commitc0bd8d8efcc501d4efa116a7cc0e802fd4e9f3e9 (patch)
treeb57f126e228673ec42047a50f0534df78d9a39b9 /js/tools
parent8e29172990126b3d3857be5d18bb6985d4cf57ca (diff)
downloadninja-c0bd8d8efcc501d4efa116a7cc0e802fd4e9f3e9.tar.gz
draw the brush stroke in realtime
Diffstat (limited to 'js/tools')
-rw-r--r--js/tools/BrushTool.js16
1 files changed, 3 insertions, 13 deletions
diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js
index 90010cdf..93020318 100644
--- a/js/tools/BrushTool.js
+++ b/js/tools/BrushTool.js
@@ -204,20 +204,10 @@ exports.BrushTool = Montage.create(ShapeTool, {
204 204
205 var horizontalOffset = this.application.ninja.stage.userContentLeft; 205 var horizontalOffset = this.application.ninja.stage.userContentLeft;
206 var verticalOffset = this.application.ninja.stage.userContentTop; 206 var verticalOffset = this.application.ninja.stage.userContentTop;
207 var origX = -horizontalOffset;
208 var origY = -verticalOffset;
209 this._selectedBrushStroke.drawToContext(ctx, origX, origY);
207 210
208 var numPoints = this._selectedBrushStroke.getNumPoints();
209 ctx.lineWidth = 1;
210 ctx.strokeStyle = "black";
211 ctx.beginPath();
212 var pt = this._selectedBrushStroke.getPoint(0);
213 ctx.moveTo(pt[0]+ horizontalOffset,pt[1]+ verticalOffset);
214 for (var i = 1; i < numPoints; i++) {
215 pt = this._selectedBrushStroke.getPoint(i);
216 var x = pt[0]+ horizontalOffset;
217 var y = pt[1]+ verticalOffset;
218 ctx.lineTo(x,y);
219 }
220 ctx.stroke();
221 ctx.restore(); 211 ctx.restore();
222 212
223 } 213 }