aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPushkar Joshi2012-04-19 11:58:20 -0700
committerPushkar Joshi2012-04-19 11:58:20 -0700
commitbc1bc57a7c8a32bf92bca8aa758b0ea0eeaffbc3 (patch)
treee8917a6e35bb9883bd192b6d5b97214aafc10a77
parentd703eeb01afa818a02538ec4efa66ac7350bac06 (diff)
downloadninja-bc1bc57a7c8a32bf92bca8aa758b0ea0eeaffbc3.tar.gz
correctly maintain canvas position when drawing subpaths off the XY plane (was a bug with starting drawing in those planes)
-rwxr-xr-xjs/lib/geom/sub-path.js2
-rwxr-xr-xjs/tools/PenTool.js5
2 files changed, 6 insertions, 1 deletions
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){
281}; 281};
282 282
283GLSubpath.prototype.getCanvasCenterLocalCoord = function(){ 283GLSubpath.prototype.getCanvasCenterLocalCoord = function(){
284 return this._canvasCenterLocalCoord; 284 return [this._canvasCenterLocalCoord[0],this._canvasCenterLocalCoord[1],this._canvasCenterLocalCoord[2]];
285}; 285};
286 286
287GLSubpath.prototype.getNumAnchors = function () { 287GLSubpath.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, {
572 var world = this.getGLWorld(newCanvas, this._useWebGL);//this.options.use3D);//this.CreateGLWorld(planeMat, midPt, newCanvas, this._useWebGL);//fillMaterial, strokeMaterial); 572 var world = this.getGLWorld(newCanvas, this._useWebGL);//this.options.use3D);//this.CreateGLWorld(planeMat, midPt, newCanvas, this._useWebGL);//fillMaterial, strokeMaterial);
573 //store a reference to this newly created canvas 573 //store a reference to this newly created canvas
574 this._selectedSubpathCanvas = newCanvas; 574 this._selectedSubpathCanvas = newCanvas;
575 this._selectedSubpathPlaneMat = ElementMediator.getMatrix(newCanvas);
575 576
576 var subpath = this._selectedSubpath; //new GLSubpath(); 577 var subpath = this._selectedSubpath; //new GLSubpath();
577 subpath.setWorld(world); 578 subpath.setWorld(world);
@@ -820,6 +821,7 @@ exports.PenTool = Montage.create(ShapeTool, {
820 }, 821 },
821 822
822 //perform the inverse of the perspective scaling performed by the browser 823 //perform the inverse of the perspective scaling performed by the browser
824 // (currently unused function)
823 _unprojectPt: { 825 _unprojectPt: {
824 value: function(pt, pespectiveDist) { 826 value: function(pt, pespectiveDist) {
825 var retPt = pt.slice(0); 827 var retPt = pt.slice(0);
@@ -1254,6 +1256,8 @@ exports.PenTool = Montage.create(ShapeTool, {
1254 if (wasSelected) { 1256 if (wasSelected) {
1255 defaultEventManager.addEventListener("resetPenTool", this, false); 1257 defaultEventManager.addEventListener("resetPenTool", this, false);
1256 this.application.ninja.elementMediator.deleteDelegate = this; 1258 this.application.ninja.elementMediator.deleteDelegate = this;
1259 this.application.ninja.stage.drawingCanvas.style.cursor = //"auto";
1260 "url('images/cursors/penCursors/Pen_newPath.png') 5 1, default";
1257 1261
1258 if (this.application.ninja.selectedElements.length === 0){ 1262 if (this.application.ninja.selectedElements.length === 0){
1259 this._entryEditMode = this.ENTRY_SELECT_NONE; 1263 this._entryEditMode = this.ENTRY_SELECT_NONE;
@@ -1328,6 +1332,7 @@ exports.PenTool = Montage.create(ShapeTool, {
1328 this._selectedSubpath.createSamples(false); 1332 this._selectedSubpath.createSamples(false);
1329 //clear the canvas 1333 //clear the canvas
1330 this.application.ninja.stage.clearDrawingCanvas();//stageManagerModule.stageManager.clearDrawingCanvas(); 1334 this.application.ninja.stage.clearDrawingCanvas();//stageManagerModule.stageManager.clearDrawingCanvas();
1335 this.PrepareSelectedSubpathForRendering();
1331 this.DrawSubpathAnchors(this._selectedSubpath); 1336 this.DrawSubpathAnchors(this._selectedSubpath);
1332 this.ShowSelectedSubpath(); 1337 this.ShowSelectedSubpath();
1333 } 1338 }