aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorPushkar Joshi2012-04-03 14:50:34 -0700
committerPushkar Joshi2012-04-03 14:50:34 -0700
commit79fb912bdaa22b8107bbddc93d1779820af80cf9 (patch)
tree022c08e2cff19d1599808037684b271dedecb146 /js/tools
parent06970d710f7172ee5ab736ef082c7703c61bfd0c (diff)
downloadninja-79fb912bdaa22b8107bbddc93d1779820af80cf9.tar.gz
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)
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/PenTool.js9
1 files changed, 8 insertions, 1 deletions
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, {
68 //the plane matrix for the first click...so the entire path is on the same plane 68 //the plane matrix for the first click...so the entire path is on the same plane
69 _penPlaneMat: { value: null, writable: true }, 69 _penPlaneMat: { value: null, writable: true },
70 70
71 //the plane equation (in stage world space) for the current path being drawn
72 _dragPlane: {value: null, writable: true},
73
71 //index of the anchor point that the user has hovered over 74 //index of the anchor point that the user has hovered over
72 _hoveredAnchorIndex: {value: -1, writable: true}, 75 _hoveredAnchorIndex: {value: -1, writable: true},
73 76
@@ -105,7 +108,9 @@ exports.PenTool = Montage.create(ShapeTool, {
105 snapManager.enableSnapAlign(false); 108 snapManager.enableSnapAlign(false);
106 109
107 var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(x,y)); 110 var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(x,y));
111 //todo fix this function to allow us to get the correct location (in 3D) for the mouse position
108 var unsnappedpos = DrawingToolBase.getHitRecPos(snapManager.snap(point.x, point.y, false)); 112 var unsnappedpos = DrawingToolBase.getHitRecPos(snapManager.snap(point.x, point.y, false));
113 this._dragPlane = snapManager.getDragPlane();
109 114
110 snapManager.enableElementSnap(elemSnap); 115 snapManager.enableElementSnap(elemSnap);
111 snapManager.enableGridSnap(gridSnap); 116 snapManager.enableGridSnap(gridSnap);
@@ -214,6 +219,7 @@ exports.PenTool = Montage.create(ShapeTool, {
214 if (this._selectedSubpath.getIsClosed() && this._makeMultipleSubpaths) { 219 if (this._selectedSubpath.getIsClosed() && this._makeMultipleSubpaths) {
215 this._penCanvas = null; 220 this._penCanvas = null;
216 this._penPlaneMat = null; 221 this._penPlaneMat = null;
222 this._dragPlane = null;
217 this._snapTarget = null; 223 this._snapTarget = null;
218 this._selectedSubpath = new SubPath(); 224 this._selectedSubpath = new SubPath();
219 this._isNewPath = true; 225 this._isNewPath = true;
@@ -404,7 +410,8 @@ exports.PenTool = Montage.create(ShapeTool, {
404 this._selectedSubpath.setPlaneMatrix(this._penPlaneMat); 410 this._selectedSubpath.setPlaneMatrix(this._penPlaneMat);
405 var planeMatInv = glmat4.inverse( this._penPlaneMat, [] ); 411 var planeMatInv = glmat4.inverse( this._penPlaneMat, [] );
406 this._selectedSubpath.setPlaneMatrixInverse(planeMatInv); 412 this._selectedSubpath.setPlaneMatrixInverse(planeMatInv);
407 413 this._selectedSubpath.setDragPlane(this._dragPlane);
414
408 this._selectedSubpath.createSamples(); //dirty bit is checked here 415 this._selectedSubpath.createSamples(); //dirty bit is checked here
409 this._selectedSubpath.buildLocalCoord(); //local dirty bit is checked here 416 this._selectedSubpath.buildLocalCoord(); //local dirty bit is checked here
410 417