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 From e28eb9158a50d7e6d97dbc68066e591ac600c241 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 5 Jun 2012 21:40:44 -0700 Subject: removing all model creators. The elementModel is now a getter that will create a new model when needed. Signed-off-by: Valerio Virgillito --- js/tools/BrushTool.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js/tools/BrushTool.js') diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js index 0be378fd..f7c8ea1e 100644 --- a/js/tools/BrushTool.js +++ b/js/tools/BrushTool.js @@ -376,7 +376,6 @@ exports.BrushTool = Montage.create(ShapeTool, { if (!canvas) { var newCanvas = document.application.njUtils.make("canvas", {"data-RDGE-id": NJUtils.generateRandom()}, this.application.ninja.currentDocument); - document.application.njUtils.createModelWithShape(newCanvas, "Brushstroke"); var styles = document.application.njUtils.stylesFromDraw(newCanvas, w, h, {midPt: midPt, planeMat: planeMat}); this.application.ninja.elementMediator.addElements(newCanvas, styles, false); -- cgit v1.2.3 From 763baf19f032c6fbae18963402b79d5d5510d923 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Thu, 7 Jun 2012 09:49:02 -0700 Subject: change the PI to make it look like the fill color affects the brush stroke color --- js/tools/BrushTool.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/tools/BrushTool.js') diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js index f85978ad..db369a88 100644 --- a/js/tools/BrushTool.js +++ b/js/tools/BrushTool.js @@ -138,7 +138,7 @@ exports.BrushTool = Montage.create(ShapeTool, { } else { colorArray = [1,1,1,0]; } - this._selectedBrushStroke.setStrokeColor(colorArray); + this._selectedBrushStroke.setFillColor(colorArray); //add this point to the brush stroke in case the user does a mouse up before doing a mouse move var currMousePos = hitRec.calculateStageWorldPoint(); -- cgit v1.2.3