aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/brush-stroke.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/geom/brush-stroke.js')
-rwxr-xr-xjs/lib/geom/brush-stroke.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js
index 743dab85..efd21c4a 100755
--- a/js/lib/geom/brush-stroke.js
+++ b/js/lib/geom/brush-stroke.js
@@ -416,7 +416,7 @@ var BrushStroke = function GLBrushStroke() {
416 this._LocalPoints[i][1]+= halfheight; 416 this._LocalPoints[i][1]+= halfheight;
417 417
418 //store the original points 418 //store the original points
419 this._OrigLocalPoints .push([this._LocalPoints[i][0],this._LocalPoints[i][1],this._LocalPoints[i][2]]); 419 this._OrigLocalPoints.push([this._LocalPoints[i][0],this._LocalPoints[i][1],this._LocalPoints[i][2]]);
420 } 420 }
421 //update the bbox with the same adjustment as was made for the local points above 421 //update the bbox with the same adjustment as was made for the local points above
422 this._BBoxMax[0]+= halfwidth;this._BBoxMin[0]+= halfwidth; 422 this._BBoxMax[0]+= halfwidth;this._BBoxMin[0]+= halfwidth;
@@ -544,6 +544,10 @@ var BrushStroke = function GLBrushStroke() {
544 var bboxWidth = bboxMax[0] - bboxMin[0]; 544 var bboxWidth = bboxMax[0] - bboxMin[0];
545 var bboxHeight = bboxMax[1] - bboxMin[1]; 545 var bboxHeight = bboxMax[1] - bboxMin[1];
546 546
547 if (!this._canvas){
548 //set the canvas by querying the world
549 this._canvas = this.getWorld().getCanvas();
550 }
547 if (this._canvas) { 551 if (this._canvas) {
548 var newLeft = Math.round(this._stageWorldCenter[0] - 0.5 * bboxWidth); 552 var newLeft = Math.round(this._stageWorldCenter[0] - 0.5 * bboxWidth);
549 var newTop = Math.round(this._stageWorldCenter[1] - 0.5 * bboxHeight); 553 var newTop = Math.round(this._stageWorldCenter[1] - 0.5 * bboxHeight);
@@ -553,7 +557,7 @@ var BrushStroke = function GLBrushStroke() {
553 557
554 CanvasController.setProperty(this._canvas, "width", bboxWidth+"px"); 558 CanvasController.setProperty(this._canvas, "width", bboxWidth+"px");
555 CanvasController.setProperty(this._canvas, "height", bboxHeight+"px"); 559 CanvasController.setProperty(this._canvas, "height", bboxHeight+"px");
556 this._canvas.elementModel.shapeModel.GLWorld.setViewportFromCanvas(this._canvas); 560 //this._canvas.elementModel.shapeModel.GLWorld.setViewportFromCanvas(this._canvas);
557 } 561 }
558 562
559 563
@@ -665,8 +669,8 @@ var BrushStroke = function GLBrushStroke() {
665 this._copyCoordinates3D(this._OrigLocalPoints, retObject.origLocalPoints); //todo <ditto> 669 this._copyCoordinates3D(this._OrigLocalPoints, retObject.origLocalPoints); //todo <ditto>
666 670
667 retObject.stageWorldCenter = [this._stageWorldCenter[0],this._stageWorldCenter[1],this._stageWorldCenter[2]]; 671 retObject.stageWorldCenter = [this._stageWorldCenter[0],this._stageWorldCenter[1],this._stageWorldCenter[2]];
668 retObject.planeMat = [this._planeMat[0],this._planeMat[1],this._planeMat[2],this._planeMat[3]]; 672 retObject.planeMat = this._planeMat;
669 retObject.planeMatInv = [this._planeMatInv[0],this._planeMatInv[1],this._planeMatInv[2],this._planeMatInv[3]]; 673 retObject.planeMatInv = this._planeMatInv;
670 retObject.dragPlane = [this._dragPlane[0],this._dragPlane[1],this._dragPlane[2],this._dragPlane[3]]; 674 retObject.dragPlane = [this._dragPlane[0],this._dragPlane[1],this._dragPlane[2],this._dragPlane[3]];
671 675
672 //stroke appearance properties 676 //stroke appearance properties
@@ -694,8 +698,8 @@ var BrushStroke = function GLBrushStroke() {
694 this._copyCoordinates3D(jo.origLocalPoints, this._OrigLocalPoints); //todo <ditto> 698 this._copyCoordinates3D(jo.origLocalPoints, this._OrigLocalPoints); //todo <ditto>
695 699
696 this._stageWorldCenter = [jo.stageWorldCenter[0],jo.stageWorldCenter[1],jo.stageWorldCenter[2]]; 700 this._stageWorldCenter = [jo.stageWorldCenter[0],jo.stageWorldCenter[1],jo.stageWorldCenter[2]];
697 this._planeMat = [jo.planeMat[0], jo.planeMat[1],jo.planeMat[2],jo.planeMat[3]]; 701 this._planeMat = jo.planeMat;
698 this._planeMatInv = [jo.planeMatInv[0],jo.planeMatInv[1],jo.planeMatInv[2],jo.planeMatInv[3]]; 702 this._planeMatInv = jo.planeMatInv;
699 this._dragPlane = [jo.dragPlane[0],jo.dragPlane[1],jo.dragPlane[2],jo.dragPlane[3]]; 703 this._dragPlane = [jo.dragPlane[0],jo.dragPlane[1],jo.dragPlane[2],jo.dragPlane[3]];
700 704
701 //stroke appearance properties 705 //stroke appearance properties