From d91e67e06095afbdbe47353eb71d2829a9a9c401 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Tue, 1 May 2012 14:52:12 -0700 Subject: handle left button up correctly for the brush tool --- js/tools/BrushTool.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'js/tools/BrushTool.js') diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js index ded56ecc..1666d311 100644 --- a/js/tools/BrushTool.js +++ b/js/tools/BrushTool.js @@ -225,9 +225,11 @@ exports.BrushTool = Montage.create(ShapeTool, { this._hasDraw = false; //finish giving enough info. to the brush stroke - this._selectedBrushStroke.setPlaneMatrix(this._brushStrokePlaneMat); - this._selectedBrushStroke.setPlaneMatrixInverse(glmat4.inverse(this._brushStrokePlaneMat,[])); - this._selectedBrushStroke.setDragPlane(this._draggingPlane); + if (this._selectedBrushStroke){ + this._selectedBrushStroke.setPlaneMatrix(this._brushStrokePlaneMat); + this._selectedBrushStroke.setPlaneMatrixInverse(glmat4.inverse(this._brushStrokePlaneMat,[])); + this._selectedBrushStroke.setDragPlane(this._draggingPlane); + } //display the previously drawn stroke in a separate canvas this.RenderCurrentBrushStroke(); -- cgit v1.2.3 From c385a1d2d8154e2c5b005c0caca5a46318f6928f Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Tue, 29 May 2012 08:26:55 -0700 Subject: rename dragging plane to dragPlane (for consistency with ShapeTool) --- js/tools/BrushTool.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/tools/BrushTool.js') diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js index 03edef79..f85978ad 100644 --- a/js/tools/BrushTool.js +++ b/js/tools/BrushTool.js @@ -39,7 +39,7 @@ exports.BrushTool = Montage.create(ShapeTool, { //view options _brushStrokeCanvas: {value: null, writable: true}, _brushStrokePlaneMat: {value: null, writable: true}, - _draggingPlane: {value: null, writable: true}, + dragPlane: {value: null, writable: true}, //the current brush stroke _selectedBrushStroke: {value: null, writable: true}, @@ -67,7 +67,7 @@ exports.BrushTool = Montage.create(ShapeTool, { var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(x,y)); var unsnappedpos = DrawingToolBase.getHitRecPos(snapManager.snap(point.x, point.y, false)); - this._draggingPlane = snapManager.getDragPlane(); + this.dragPlane = snapManager.getDragPlane(); snapManager.enableElementSnap(elemSnap); snapManager.enableGridSnap(gridSnap); @@ -100,7 +100,7 @@ exports.BrushTool = Montage.create(ShapeTool, { } var tmpPoint = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(x,y)); var hitRec = snapManager.snap(tmpPoint.x, tmpPoint.y, false); - this._draggingPlane = snapManager.getDragPlane(); + this.dragPlane = snapManager.getDragPlane(); if (this._selectedSubpathCanvas){ snapManager.popWorkingPlane(); } @@ -228,7 +228,7 @@ exports.BrushTool = Montage.create(ShapeTool, { if (this._selectedBrushStroke){ this._selectedBrushStroke.setPlaneMatrix(this._brushStrokePlaneMat); this._selectedBrushStroke.setPlaneMatrixInverse(glmat4.inverse(this._brushStrokePlaneMat,[])); - this._selectedBrushStroke.setDragPlane(this._draggingPlane); + this._selectedBrushStroke.setDragPlane(this.dragPlane); } //display the previously drawn stroke in a separate canvas -- cgit v1.2.3