aboutsummaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib')
-rwxr-xr-xjs/lib/geom/brush-stroke.js26
1 files changed, 20 insertions, 6 deletions
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js
index 89ef79fb..1fae0c1d 100755
--- a/js/lib/geom/brush-stroke.js
+++ b/js/lib/geom/brush-stroke.js
@@ -568,11 +568,11 @@ var BrushStroke = function GLBrushStroke() {
568 } 568 }
569 ctx.save(); 569 ctx.save();
570 ctx.clearRect(0, 0, bboxWidth, bboxHeight); 570 ctx.clearRect(0, 0, bboxWidth, bboxHeight);
571 this.drawToContext(ctx, 0, 0, false); 571 this.drawToContext(ctx, false);
572 ctx.restore(); 572 ctx.restore();
573 } //this.render() 573 } //this.render()
574 574
575 this.drawToContext = function(ctx, deltaX, deltaY, drawStageWorldPts, stageWorldToScreenMat){ 575 this.drawToContext = function(ctx, drawStageWorldPts, stageWorldDeltaX, stageWorldDeltaY, stageWorldToScreenMat){
576 var points = this._LocalPoints; 576 var points = this._LocalPoints;
577 if (drawStageWorldPts){ //this is usually true when we're drawing the brush stroke on the stage (no canvas yet) 577 if (drawStageWorldPts){ //this is usually true when we're drawing the brush stroke on the stage (no canvas yet)
578 points = this._Points; 578 points = this._Points;
@@ -623,9 +623,23 @@ var BrushStroke = function GLBrushStroke() {
623 //ctx.strokeStyle="rgba("+parseInt(255*currStrokeColor[0])+","+parseInt(255*currStrokeColor[1])+","+parseInt(255*currStrokeColor[2])+","+alphaVal+")"; 623 //ctx.strokeStyle="rgba("+parseInt(255*currStrokeColor[0])+","+parseInt(255*currStrokeColor[1])+","+parseInt(255*currStrokeColor[2])+","+alphaVal+")";
624 ctx.translate(disp[0],disp[1]); 624 ctx.translate(disp[0],disp[1]);
625 ctx.beginPath(); 625 ctx.beginPath();
626 ctx.moveTo(points[0][0]-deltaX, points[0][1]-deltaY); 626 if (drawStageWorldPts) {
627 tempP = points[0].slice(0);
628 tempP[0]+=stageWorldDeltaX; tempP[1]+=stageWorldDeltaY;
629 p = MathUtils.transformAndDivideHomogeneousPoint(tempP, stageWorldToScreenMat);
630 } else {
631 p = points[0];
632 }
633 ctx.moveTo(p[0],p[1]);
627 for (var i=0;i<numPoints;i++){ 634 for (var i=0;i<numPoints;i++){
628 ctx.lineTo(points[i][0]-deltaX, points[i][1]-deltaY); 635 if (drawStageWorldPts) {
636 tempP = points[i].slice(0);
637 tempP[0]+=stageWorldDeltaX; tempP[1]+=stageWorldDeltaY;
638 p = MathUtils.transformAndDivideHomogeneousPoint(tempP, stageWorldToScreenMat);
639 } else {
640 p = points[i];
641 }
642 ctx.lineTo(p[0],p[1]);
629 } 643 }
630 ctx.stroke(); 644 ctx.stroke();
631 ctx.restore(); 645 ctx.restore();
@@ -643,7 +657,7 @@ var BrushStroke = function GLBrushStroke() {
643 ctx.beginPath(); 657 ctx.beginPath();
644 if (drawStageWorldPts) { 658 if (drawStageWorldPts) {
645 tempP = points[0].slice(0); 659 tempP = points[0].slice(0);
646 tempP[0]+=deltaX; tempP[1]+=deltaY; 660 tempP[0]+=stageWorldDeltaX; tempP[1]+=stageWorldDeltaY;
647 p = MathUtils.transformAndDivideHomogeneousPoint(tempP, stageWorldToScreenMat); 661 p = MathUtils.transformAndDivideHomogeneousPoint(tempP, stageWorldToScreenMat);
648 } else { 662 } else {
649 p = points[0]; 663 p = points[0];
@@ -656,7 +670,7 @@ var BrushStroke = function GLBrushStroke() {
656 for (var i=1;i<numPoints;i++){ 670 for (var i=1;i<numPoints;i++){
657 if (drawStageWorldPts) { 671 if (drawStageWorldPts) {
658 tempP = points[i].slice(0); 672 tempP = points[i].slice(0);
659 tempP[0]+=deltaX; tempP[1]+=deltaY; 673 tempP[0]+=stageWorldDeltaX; tempP[1]+=stageWorldDeltaY;
660 p = MathUtils.transformAndDivideHomogeneousPoint(tempP, stageWorldToScreenMat); 674 p = MathUtils.transformAndDivideHomogeneousPoint(tempP, stageWorldToScreenMat);
661 } else { 675 } else {
662 p = points[i]; 676 p = points[i];