From bc1bc57a7c8a32bf92bca8aa758b0ea0eeaffbc3 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Thu, 19 Apr 2012 11:58:20 -0700 Subject: correctly maintain canvas position when drawing subpaths off the XY plane (was a bug with starting drawing in those planes) --- js/lib/geom/sub-path.js | 2 +- js/tools/PenTool.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/js/lib/geom/sub-path.js b/js/lib/geom/sub-path.js index 60335990..43420bc9 100755 --- a/js/lib/geom/sub-path.js +++ b/js/lib/geom/sub-path.js @@ -281,7 +281,7 @@ GLSubpath.prototype.setCanvasCenterLocalCoord = function(center){ }; GLSubpath.prototype.getCanvasCenterLocalCoord = function(){ - return this._canvasCenterLocalCoord; + return [this._canvasCenterLocalCoord[0],this._canvasCenterLocalCoord[1],this._canvasCenterLocalCoord[2]]; }; GLSubpath.prototype.getNumAnchors = function () { diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js index 8ac48d55..ffad2789 100755 --- a/js/tools/PenTool.js +++ b/js/tools/PenTool.js @@ -572,6 +572,7 @@ exports.PenTool = Montage.create(ShapeTool, { var world = this.getGLWorld(newCanvas, this._useWebGL);//this.options.use3D);//this.CreateGLWorld(planeMat, midPt, newCanvas, this._useWebGL);//fillMaterial, strokeMaterial); //store a reference to this newly created canvas this._selectedSubpathCanvas = newCanvas; + this._selectedSubpathPlaneMat = ElementMediator.getMatrix(newCanvas); var subpath = this._selectedSubpath; //new GLSubpath(); subpath.setWorld(world); @@ -820,6 +821,7 @@ exports.PenTool = Montage.create(ShapeTool, { }, //perform the inverse of the perspective scaling performed by the browser + // (currently unused function) _unprojectPt: { value: function(pt, pespectiveDist) { var retPt = pt.slice(0); @@ -1254,6 +1256,8 @@ exports.PenTool = Montage.create(ShapeTool, { if (wasSelected) { defaultEventManager.addEventListener("resetPenTool", this, false); this.application.ninja.elementMediator.deleteDelegate = this; + this.application.ninja.stage.drawingCanvas.style.cursor = //"auto"; + "url('images/cursors/penCursors/Pen_newPath.png') 5 1, default"; if (this.application.ninja.selectedElements.length === 0){ this._entryEditMode = this.ENTRY_SELECT_NONE; @@ -1328,6 +1332,7 @@ exports.PenTool = Montage.create(ShapeTool, { this._selectedSubpath.createSamples(false); //clear the canvas this.application.ninja.stage.clearDrawingCanvas();//stageManagerModule.stageManager.clearDrawingCanvas(); + this.PrepareSelectedSubpathForRendering(); this.DrawSubpathAnchors(this._selectedSubpath); this.ShowSelectedSubpath(); } -- cgit v1.2.3