aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools')
-rw-r--r--js/tools/BrushTool.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js
index 752aa2a3..dd201f33 100644
--- a/js/tools/BrushTool.js
+++ b/js/tools/BrushTool.js
@@ -5,6 +5,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
5</copyright> */ 5</copyright> */
6 6
7var ShapeTool = require("js/tools/ShapeTool").ShapeTool; 7var ShapeTool = require("js/tools/ShapeTool").ShapeTool;
8var ShapesController = require("js/controllers/elements/shapes-controller").ShapesController;
8var DrawingToolBase = require("js/tools/drawing-tool-base").DrawingToolBase; 9var DrawingToolBase = require("js/tools/drawing-tool-base").DrawingToolBase;
9var defaultEventManager = require("montage/core/event/event-manager").defaultEventManager; 10var defaultEventManager = require("montage/core/event/event-manager").defaultEventManager;
10var Montage = require("montage/core/core").Montage; 11var Montage = require("montage/core/core").Montage;
@@ -69,12 +70,24 @@ exports.BrushTool = Montage.create(ShapeTool, {
69 if (this.application.ninja.colorController.colorToolbar.stroke.webGlColor){ 70 if (this.application.ninja.colorController.colorToolbar.stroke.webGlColor){
70 this._selectedBrushStroke.setStrokeColor(this.application.ninja.colorController.colorToolbar.stroke.webGlColor); 71 this._selectedBrushStroke.setStrokeColor(this.application.ninja.colorController.colorToolbar.stroke.webGlColor);
71 } 72 }
73 if (this.application.ninja.colorController.colorToolbar.fill.webGlColor){
74 this._selectedBrushStroke.setSecondStrokeColor(this.application.ninja.colorController.colorToolbar.fill.webGlColor);
75 }
72 //add this point to the brush stroke in case the user does a mouse up before doing a mouse move 76 //add this point to the brush stroke in case the user does a mouse up before doing a mouse move
73 var currMousePos = this._getUnsnappedPosition(event.pageX, event.pageY); 77 var currMousePos = this._getUnsnappedPosition(event.pageX, event.pageY);
74 this._selectedBrushStroke.addPoint(currMousePos); 78 this._selectedBrushStroke.addPoint(currMousePos);
75 79
76 //TODO get these values from the options 80 var strokeSize = 1;
77 this._selectedBrushStroke.setStrokeWidth(20); 81 if (this.options.strokeSize) {
82 strokeSize = ShapesController.GetValueInPixels(this.options.strokeSize.value, this.options.strokeSize.units);
83 }
84 this._selectedBrushStroke.setStrokeWidth(strokeSize);
85
86 var strokeHardness = 100;
87 if (this.options.strokeHardness){
88 strokeHardness = ShapesController.GetValueInPixels(this.options.strokeHardness.value, this.options.strokeHardness.units);
89 }
90 this._selectedBrushStroke.setStrokeHardness(strokeHardness);
78 } 91 }
79 NJevent("enableStageMove");//stageManagerModule.stageManager.enableMouseMove(); 92 NJevent("enableStageMove");//stageManagerModule.stageManager.enableMouseMove();
80 } //value: function (event) { 93 } //value: function (event) {
@@ -114,7 +127,7 @@ exports.BrushTool = Montage.create(ShapeTool, {
114 127
115 if (this._isDrawing) { 128 if (this._isDrawing) {
116 var currMousePos = this._getUnsnappedPosition(event.pageX, event.pageY); 129 var currMousePos = this._getUnsnappedPosition(event.pageX, event.pageY);
117 if (this._selectedBrushStroke && this._selectedBrushStroke.getNumPoints()<100){ 130 if (this._selectedBrushStroke && this._selectedBrushStroke.getNumPoints()<1000){
118 this._selectedBrushStroke.addPoint(currMousePos); 131 this._selectedBrushStroke.addPoint(currMousePos);
119 } 132 }
120 this.ShowCurrentBrushStrokeOnStage(); 133 this.ShowCurrentBrushStrokeOnStage();