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/tools/PenTool.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'js/tools') diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js index 91b7606e..2eae6adc 100755 --- a/js/tools/PenTool.js +++ b/js/tools/PenTool.js @@ -68,6 +68,9 @@ exports.PenTool = Montage.create(ShapeTool, { //the plane matrix for the first click...so the entire path is on the same plane _penPlaneMat: { value: null, writable: true }, + //the plane equation (in stage world space) for the current path being drawn + _dragPlane: {value: null, writable: true}, + //index of the anchor point that the user has hovered over _hoveredAnchorIndex: {value: -1, writable: true}, @@ -105,7 +108,9 @@ exports.PenTool = Montage.create(ShapeTool, { snapManager.enableSnapAlign(false); var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(x,y)); + //todo fix this function to allow us to get the correct location (in 3D) for the mouse position var unsnappedpos = DrawingToolBase.getHitRecPos(snapManager.snap(point.x, point.y, false)); + this._dragPlane = snapManager.getDragPlane(); snapManager.enableElementSnap(elemSnap); snapManager.enableGridSnap(gridSnap); @@ -214,6 +219,7 @@ exports.PenTool = Montage.create(ShapeTool, { if (this._selectedSubpath.getIsClosed() && this._makeMultipleSubpaths) { this._penCanvas = null; this._penPlaneMat = null; + this._dragPlane = null; this._snapTarget = null; this._selectedSubpath = new SubPath(); this._isNewPath = true; @@ -404,7 +410,8 @@ exports.PenTool = Montage.create(ShapeTool, { this._selectedSubpath.setPlaneMatrix(this._penPlaneMat); var planeMatInv = glmat4.inverse( this._penPlaneMat, [] ); this._selectedSubpath.setPlaneMatrixInverse(planeMatInv); - + this._selectedSubpath.setDragPlane(this._dragPlane); + this._selectedSubpath.createSamples(); //dirty bit is checked here this._selectedSubpath.buildLocalCoord(); //local dirty bit is checked here -- cgit v1.2.3