From 878743cbbb75f2fc84855ca27779597b67ab1a95 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Mon, 2 Apr 2012 15:25:00 -0700 Subject: render the pen path with local coordinates, but use stage world coordinates to position the canvas on which the path is rendered AND add data-montage- to the ids in the pen and brush reels AND fix a bug with pen stroke transparency not working --- js/lib/geom/brush-stroke.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/lib/geom/brush-stroke.js') diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js index 22209815..e93c9382 100755 --- a/js/lib/geom/brush-stroke.js +++ b/js/lib/geom/brush-stroke.js @@ -413,7 +413,7 @@ var BrushStroke = function GLBrushStroke() { this._LocalPoints[i][1]+= halfheight; //store the original points - this._OrigLocalPoints .push([this._LocalPoints[i][0],this._LocalPoints[i][1],this._LocalPoints[i][2]]); + this._OrigLocalPoints.push([this._LocalPoints[i][0],this._LocalPoints[i][1],this._LocalPoints[i][2]]); } //update the bbox with the same adjustment as was made for the local points above this._BBoxMax[0]+= halfwidth;this._BBoxMin[0]+= halfwidth; -- cgit v1.2.3 From 79fb912bdaa22b8107bbddc93d1779820af80cf9 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Tue, 3 Apr 2012 14:50:34 -0700 Subject: working File I/O for pen tool created paths and some minor bug fixes (correctly setting the canvas for brush stroke file I/O, correct plane matrix for file I/O) --- js/lib/geom/brush-stroke.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'js/lib/geom/brush-stroke.js') diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js index e93c9382..2a751a89 100755 --- a/js/lib/geom/brush-stroke.js +++ b/js/lib/geom/brush-stroke.js @@ -541,6 +541,10 @@ var BrushStroke = function GLBrushStroke() { var bboxWidth = bboxMax[0] - bboxMin[0]; var bboxHeight = bboxMax[1] - bboxMin[1]; + if (!this._canvas){ + //set the canvas by querying the world + this._canvas = this.getWorld().getCanvas(); + } if (this._canvas) { var newLeft = Math.round(this._stageWorldCenter[0] - 0.5 * bboxWidth); var newTop = Math.round(this._stageWorldCenter[1] - 0.5 * bboxHeight); @@ -550,7 +554,7 @@ var BrushStroke = function GLBrushStroke() { CanvasController.setProperty(this._canvas, "width", bboxWidth+"px"); CanvasController.setProperty(this._canvas, "height", bboxHeight+"px"); - this._canvas.elementModel.shapeModel.GLWorld.setViewportFromCanvas(this._canvas); + //this._canvas.elementModel.shapeModel.GLWorld.setViewportFromCanvas(this._canvas); } @@ -662,8 +666,8 @@ var BrushStroke = function GLBrushStroke() { this._copyCoordinates3D(this._OrigLocalPoints, retObject.origLocalPoints); //todo retObject.stageWorldCenter = [this._stageWorldCenter[0],this._stageWorldCenter[1],this._stageWorldCenter[2]]; - retObject.planeMat = [this._planeMat[0],this._planeMat[1],this._planeMat[2],this._planeMat[3]]; - retObject.planeMatInv = [this._planeMatInv[0],this._planeMatInv[1],this._planeMatInv[2],this._planeMatInv[3]]; + retObject.planeMat = this._planeMat; + retObject.planeMatInv = this._planeMatInv; retObject.dragPlane = [this._dragPlane[0],this._dragPlane[1],this._dragPlane[2],this._dragPlane[3]]; //stroke appearance properties @@ -691,8 +695,8 @@ var BrushStroke = function GLBrushStroke() { this._copyCoordinates3D(jo.origLocalPoints, this._OrigLocalPoints); //todo this._stageWorldCenter = [jo.stageWorldCenter[0],jo.stageWorldCenter[1],jo.stageWorldCenter[2]]; - this._planeMat = [jo.planeMat[0], jo.planeMat[1],jo.planeMat[2],jo.planeMat[3]]; - this._planeMatInv = [jo.planeMatInv[0],jo.planeMatInv[1],jo.planeMatInv[2],jo.planeMatInv[3]]; + this._planeMat = jo.planeMat; + this._planeMatInv = jo.planeMatInv; this._dragPlane = [jo.dragPlane[0],jo.dragPlane[1],jo.dragPlane[2],jo.dragPlane[3]]; //stroke appearance properties -- cgit v1.2.3