diff options
Diffstat (limited to 'js/lib/geom/brush-stroke.js')
-rwxr-xr-x | js/lib/geom/brush-stroke.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js index 22209815..2a751a89 100755 --- a/js/lib/geom/brush-stroke.js +++ b/js/lib/geom/brush-stroke.js | |||
@@ -413,7 +413,7 @@ var BrushStroke = function GLBrushStroke() { | |||
413 | this._LocalPoints[i][1]+= halfheight; | 413 | this._LocalPoints[i][1]+= halfheight; |
414 | 414 | ||
415 | //store the original points | 415 | //store the original points |
416 | this._OrigLocalPoints .push([this._LocalPoints[i][0],this._LocalPoints[i][1],this._LocalPoints[i][2]]); | 416 | this._OrigLocalPoints.push([this._LocalPoints[i][0],this._LocalPoints[i][1],this._LocalPoints[i][2]]); |
417 | } | 417 | } |
418 | //update the bbox with the same adjustment as was made for the local points above | 418 | //update the bbox with the same adjustment as was made for the local points above |
419 | this._BBoxMax[0]+= halfwidth;this._BBoxMin[0]+= halfwidth; | 419 | this._BBoxMax[0]+= halfwidth;this._BBoxMin[0]+= halfwidth; |
@@ -541,6 +541,10 @@ var BrushStroke = function GLBrushStroke() { | |||
541 | var bboxWidth = bboxMax[0] - bboxMin[0]; | 541 | var bboxWidth = bboxMax[0] - bboxMin[0]; |
542 | var bboxHeight = bboxMax[1] - bboxMin[1]; | 542 | var bboxHeight = bboxMax[1] - bboxMin[1]; |
543 | 543 | ||
544 | if (!this._canvas){ | ||
545 | //set the canvas by querying the world | ||
546 | this._canvas = this.getWorld().getCanvas(); | ||
547 | } | ||
544 | if (this._canvas) { | 548 | if (this._canvas) { |
545 | var newLeft = Math.round(this._stageWorldCenter[0] - 0.5 * bboxWidth); | 549 | var newLeft = Math.round(this._stageWorldCenter[0] - 0.5 * bboxWidth); |
546 | var newTop = Math.round(this._stageWorldCenter[1] - 0.5 * bboxHeight); | 550 | var newTop = Math.round(this._stageWorldCenter[1] - 0.5 * bboxHeight); |
@@ -550,7 +554,7 @@ var BrushStroke = function GLBrushStroke() { | |||
550 | 554 | ||
551 | CanvasController.setProperty(this._canvas, "width", bboxWidth+"px"); | 555 | CanvasController.setProperty(this._canvas, "width", bboxWidth+"px"); |
552 | CanvasController.setProperty(this._canvas, "height", bboxHeight+"px"); | 556 | CanvasController.setProperty(this._canvas, "height", bboxHeight+"px"); |
553 | this._canvas.elementModel.shapeModel.GLWorld.setViewportFromCanvas(this._canvas); | 557 | //this._canvas.elementModel.shapeModel.GLWorld.setViewportFromCanvas(this._canvas); |
554 | } | 558 | } |
555 | 559 | ||
556 | 560 | ||
@@ -662,8 +666,8 @@ var BrushStroke = function GLBrushStroke() { | |||
662 | this._copyCoordinates3D(this._OrigLocalPoints, retObject.origLocalPoints); //todo <ditto> | 666 | this._copyCoordinates3D(this._OrigLocalPoints, retObject.origLocalPoints); //todo <ditto> |
663 | 667 | ||
664 | retObject.stageWorldCenter = [this._stageWorldCenter[0],this._stageWorldCenter[1],this._stageWorldCenter[2]]; | 668 | retObject.stageWorldCenter = [this._stageWorldCenter[0],this._stageWorldCenter[1],this._stageWorldCenter[2]]; |
665 | retObject.planeMat = [this._planeMat[0],this._planeMat[1],this._planeMat[2],this._planeMat[3]]; | 669 | retObject.planeMat = this._planeMat; |
666 | retObject.planeMatInv = [this._planeMatInv[0],this._planeMatInv[1],this._planeMatInv[2],this._planeMatInv[3]]; | 670 | retObject.planeMatInv = this._planeMatInv; |
667 | retObject.dragPlane = [this._dragPlane[0],this._dragPlane[1],this._dragPlane[2],this._dragPlane[3]]; | 671 | retObject.dragPlane = [this._dragPlane[0],this._dragPlane[1],this._dragPlane[2],this._dragPlane[3]]; |
668 | 672 | ||
669 | //stroke appearance properties | 673 | //stroke appearance properties |
@@ -691,8 +695,8 @@ var BrushStroke = function GLBrushStroke() { | |||
691 | this._copyCoordinates3D(jo.origLocalPoints, this._OrigLocalPoints); //todo <ditto> | 695 | this._copyCoordinates3D(jo.origLocalPoints, this._OrigLocalPoints); //todo <ditto> |
692 | 696 | ||
693 | this._stageWorldCenter = [jo.stageWorldCenter[0],jo.stageWorldCenter[1],jo.stageWorldCenter[2]]; | 697 | this._stageWorldCenter = [jo.stageWorldCenter[0],jo.stageWorldCenter[1],jo.stageWorldCenter[2]]; |
694 | this._planeMat = [jo.planeMat[0], jo.planeMat[1],jo.planeMat[2],jo.planeMat[3]]; | 698 | this._planeMat = jo.planeMat; |
695 | this._planeMatInv = [jo.planeMatInv[0],jo.planeMatInv[1],jo.planeMatInv[2],jo.planeMatInv[3]]; | 699 | this._planeMatInv = jo.planeMatInv; |
696 | this._dragPlane = [jo.dragPlane[0],jo.dragPlane[1],jo.dragPlane[2],jo.dragPlane[3]]; | 700 | this._dragPlane = [jo.dragPlane[0],jo.dragPlane[1],jo.dragPlane[2],jo.dragPlane[3]]; |
697 | 701 | ||
698 | //stroke appearance properties | 702 | //stroke appearance properties |