diff options
Diffstat (limited to 'js')
-rwxr-xr-x | js/data/pi/pi-data.js | 5 | ||||
-rwxr-xr-x | js/lib/geom/brush-stroke.js | 23 | ||||
-rw-r--r-- | js/tools/BrushTool.js | 2 |
3 files changed, 18 insertions, 12 deletions
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js index 157cbc64..c6cbc3cf 100755 --- a/js/data/pi/pi-data.js +++ b/js/data/pi/pi-data.js | |||
@@ -703,13 +703,14 @@ exports.PiData = Montage.create( Montage, { | |||
703 | { | 703 | { |
704 | type : "color", | 704 | type : "color", |
705 | prop: "border", | 705 | prop: "border", |
706 | id : "stroke" | 706 | id : "stroke", |
707 | visible: false | ||
707 | }, | 708 | }, |
708 | { | 709 | { |
709 | type : "color", | 710 | type : "color", |
710 | id : "fill", | 711 | id : "fill", |
711 | prop: "background", | 712 | prop: "background", |
712 | visible : false, | 713 | visible : true, |
713 | divider : true | 714 | divider : true |
714 | } | 715 | } |
715 | ], | 716 | ], |
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js index b2e56149..d9c2ab53 100755 --- a/js/lib/geom/brush-stroke.js +++ b/js/lib/geom/brush-stroke.js | |||
@@ -45,7 +45,7 @@ var BrushStroke = function GLBrushStroke() { | |||
45 | this._strokeAmountSmoothing = 0; | 45 | this._strokeAmountSmoothing = 0; |
46 | 46 | ||
47 | // currently, brush does not support a fill region | 47 | // currently, brush does not support a fill region |
48 | this.canFill = false; | 48 | this.canFill = true; |
49 | 49 | ||
50 | //threshold that tells us whether two samples are too far apart | 50 | //threshold that tells us whether two samples are too far apart |
51 | this._MAX_SAMPLE_DISTANCE_THRESHOLD = 5; | 51 | this._MAX_SAMPLE_DISTANCE_THRESHOLD = 5; |
@@ -180,7 +180,7 @@ BrushStroke.prototype.setStrokeWidth = function (w) { | |||
180 | } | 180 | } |
181 | this._isDirty=true; | 181 | this._isDirty=true; |
182 | }; | 182 | }; |
183 | 183 | /* | |
184 | BrushStroke.prototype.getStrokeMaterial = function () { | 184 | BrushStroke.prototype.getStrokeMaterial = function () { |
185 | return this._strokeMaterial; | 185 | return this._strokeMaterial; |
186 | }; | 186 | }; |
@@ -188,18 +188,24 @@ BrushStroke.prototype.getStrokeMaterial = function () { | |||
188 | BrushStroke.prototype.setStrokeMaterial = function (m) { | 188 | BrushStroke.prototype.setStrokeMaterial = function (m) { |
189 | this._strokeMaterial = m; this._isDirty = true; | 189 | this._strokeMaterial = m; this._isDirty = true; |
190 | }; | 190 | }; |
191 | 191 | */ | |
192 | BrushStroke.prototype.getStrokeColor = function () { | 192 | BrushStroke.prototype.getStrokeColor = function () { |
193 | return this._strokeColor; | 193 | return null;//return this._strokeColor; |
194 | }; | 194 | }; |
195 | 195 | ||
196 | BrushStroke.prototype.setStrokeColor = function (c) { | 196 | BrushStroke.prototype.setStrokeColor = function (c) { |
197 | this._strokeColor = c; this._isDirty = true; | 197 | //this._strokeColor = c; this._isDirty = true; |
198 | }; | 198 | }; |
199 | 199 | ||
200 | BrushStroke.prototype.setFillColor = function(c){ | 200 | BrushStroke.prototype.setFillColor = function(c){ |
201 | return; | 201 | this._strokeColor = c; this._isDirty = true; |
202 | }; //NO-OP for now as we have no fill region | 202 | }; |
203 | //sets stroke color for now as we have no fill region | ||
204 | |||
205 | BrushStroke.prototype.getFillColor = function() { | ||
206 | return this._strokeColor; | ||
207 | }; | ||
208 | //return strokeColor for now as we have no fill region | ||
203 | 209 | ||
204 | BrushStroke.prototype.setSecondStrokeColor = function(c){ | 210 | BrushStroke.prototype.setSecondStrokeColor = function(c){ |
205 | this._secondStrokeColor=c; this._isDirty = true; | 211 | this._secondStrokeColor=c; this._isDirty = true; |
@@ -732,8 +738,7 @@ BrushStroke.prototype.drawToContext = function(ctx, drawStageWorldPts, stageWorl | |||
732 | ctx.strokeStyle = this.buildColor(ctx, this._strokeColor, w, h, this._strokeWidth, alphaVal); | 738 | ctx.strokeStyle = this.buildColor(ctx, this._strokeColor, w, h, this._strokeWidth, alphaVal); |
733 | } | 739 | } |
734 | //linearly interpolate between the two stroke colors | 740 | //linearly interpolate between the two stroke colors |
735 | var currStrokeColor = VecUtils.vecInterpolate(4, this._strokeColor, this._secondStrokeColor, t/numTraces); | 741 | //var currStrokeColor = VecUtils.vecInterpolate(4, this._strokeColor, this._secondStrokeColor, t/numTraces); |
736 | //ctx.strokeStyle="rgba("+parseInt(255*currStrokeColor[0])+","+parseInt(255*currStrokeColor[1])+","+parseInt(255*currStrokeColor[2])+","+alphaVal+")"; | ||
737 | ctx.translate(disp[0],disp[1]); | 742 | ctx.translate(disp[0],disp[1]); |
738 | ctx.beginPath(); | 743 | ctx.beginPath(); |
739 | if (drawStageWorldPts) { | 744 | if (drawStageWorldPts) { |
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, { | |||
138 | } else { | 138 | } else { |
139 | colorArray = [1,1,1,0]; | 139 | colorArray = [1,1,1,0]; |
140 | } | 140 | } |
141 | this._selectedBrushStroke.setStrokeColor(colorArray); | 141 | this._selectedBrushStroke.setFillColor(colorArray); |
142 | 142 | ||
143 | //add this point to the brush stroke in case the user does a mouse up before doing a mouse move | 143 | //add this point to the brush stroke in case the user does a mouse up before doing a mouse move |
144 | var currMousePos = hitRec.calculateStageWorldPoint(); | 144 | var currMousePos = hitRec.calculateStageWorldPoint(); |