aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorPushkar Joshi2012-04-19 14:07:45 -0700
committerPushkar Joshi2012-04-19 14:07:45 -0700
commitdc1e8dde18c40cf740bd2fe09165784e0d415fab (patch)
tree5740348d70d94593c86ee6aa246d0b40f54728b6 /js/tools
parentbc1bc57a7c8a32bf92bca8aa758b0ea0eeaffbc3 (diff)
downloadninja-dc1e8dde18c40cf740bd2fe09165784e0d415fab.tar.gz
get the canvas plane matrix before multiplying it with the translation due to shift in center of rotation
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/PenTool.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index ffad2789..4258593e 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -582,6 +582,7 @@ exports.PenTool = Montage.create(ShapeTool, {
582 world.render(); 582 world.render();
583 //TODO this will not work if there are multiple shapes in the same canvas 583 //TODO this will not work if there are multiple shapes in the same canvas
584 newCanvas.elementModel.shapeModel.GLGeomObj = subpath; 584 newCanvas.elementModel.shapeModel.GLGeomObj = subpath;
585 newCanvas.elementModel.isShape = true;
585 newCanvas.elementModel.shapeModel.shapeCount++; 586 newCanvas.elementModel.shapeModel.shapeCount++;
586 if(newCanvas.elementModel.shapeModel.shapeCount === 1) 587 if(newCanvas.elementModel.shapeModel.shapeCount === 1)
587 { 588 {
@@ -601,7 +602,7 @@ exports.PenTool = Montage.create(ShapeTool, {
601 // TODO - update the shape's info only. shapeModel will likely need an array of shapes. 602 // TODO - update the shape's info only. shapeModel will likely need an array of shapes.
602 } 603 }
603 604
604 //if(newCanvas.elementModel.isShape) //todo why is this not true for the path canvas? 605 if(newCanvas.elementModel.isShape) //todo why is this not true for the path canvas?
605 { 606 {
606 this.application.ninja.selectionController.selectElement(newCanvas); 607 this.application.ninja.selectionController.selectElement(newCanvas);
607 } 608 }
@@ -643,7 +644,7 @@ exports.PenTool = Montage.create(ShapeTool, {
643 //TODO this will not work if there are multiple shapes in the same canvas 644 //TODO this will not work if there are multiple shapes in the same canvas
644 canvas.elementModel.shapeModel.GLGeomObj = subpath; 645 canvas.elementModel.shapeModel.GLGeomObj = subpath;
645 646
646 //if(newCanvas.elementModel.isShape) //todo why is this not true for the path canvas? 647 if(canvas.elementModel.isShape) //todo why is this not true for the path canvas?
647 { 648 {
648 this.application.ninja.selectionController.selectElement(canvas); 649 this.application.ninja.selectionController.selectElement(canvas);
649 } 650 }
@@ -776,6 +777,7 @@ exports.PenTool = Montage.create(ShapeTool, {
776 var tMat = Matrix.Translation([centerDisp[0], centerDisp[1],centerDisp[2]]); 777 var tMat = Matrix.Translation([centerDisp[0], centerDisp[1],centerDisp[2]]);
777 var tInvMat = Matrix.Translation([-centerDisp[0], -centerDisp[1], -centerDisp[2]]); 778 var tInvMat = Matrix.Translation([-centerDisp[0], -centerDisp[1], -centerDisp[2]]);
778 var newMat = Matrix.I(4); 779 var newMat = Matrix.I(4);
780 this._selectedSubpathPlaneMat = ElementMediator.getMatrix(this._selectedSubpathCanvas);
779 glmat4.multiply( tInvMat, this._selectedSubpathPlaneMat, newMat); 781 glmat4.multiply( tInvMat, this._selectedSubpathPlaneMat, newMat);
780 glmat4.multiply( newMat, tMat, newMat); 782 glmat4.multiply( newMat, tMat, newMat);
781 this._selectedSubpathPlaneMat = newMat; 783 this._selectedSubpathPlaneMat = newMat;
@@ -927,10 +929,8 @@ exports.PenTool = Montage.create(ShapeTool, {
927 929
928 HandleDoubleClick: { 930 HandleDoubleClick: {
929 value: function () { 931 value: function () {
930 return;
931 /*
932 //if there is a selected anchor point 932 //if there is a selected anchor point
933 if (this._selectedSubpath && this._selectedSubpath.getSelectedAnchorIndex() !== -1) { 933 if (this._selectedSubpath && this._selectedSubpath.getNumAnchors()>1 && this._selectedSubpath.getSelectedAnchorIndex() !== -1) {
934 var selAnchor = this._selectedSubpath.getAnchor(this._selectedSubpath.getSelectedAnchorIndex()); 934 var selAnchor = this._selectedSubpath.getAnchor(this._selectedSubpath.getSelectedAnchorIndex());
935 var pos = [selAnchor.getPosX(), selAnchor.getPosY(), selAnchor.getPosZ()]; 935 var pos = [selAnchor.getPosX(), selAnchor.getPosY(), selAnchor.getPosZ()];
936 var distToPrev = selAnchor.getPrevDistanceSq(pos[0], pos[1], pos[2]); 936 var distToPrev = selAnchor.getPrevDistanceSq(pos[0], pos[1], pos[2]);
@@ -992,7 +992,8 @@ exports.PenTool = Montage.create(ShapeTool, {
992 } // else of if (distToPrev < threshSq) { 992 } // else of if (distToPrev < threshSq) {
993 993
994 this._selectedSubpath.makeDirty(); 994 this._selectedSubpath.makeDirty();
995 this._selectedSubpath.createSamples(); 995 this._selectedSubpath.createSamples(false);
996 this.PrepareSelectedSubpathForRendering();
996 this.ShowSelectedSubpath(); 997 this.ShowSelectedSubpath();
997 998
998 //clear the canvas before we draw anything else 999 //clear the canvas before we draw anything else
@@ -1000,7 +1001,7 @@ exports.PenTool = Montage.create(ShapeTool, {
1000 1001
1001 this.DrawSubpathAnchors(this._selectedSubpath); 1002 this.DrawSubpathAnchors(this._selectedSubpath);
1002 } //if (this._selectedSubpath && this._selectedSubpath.getSelectedAnchorIndex() !== -1) 1003 } //if (this._selectedSubpath && this._selectedSubpath.getSelectedAnchorIndex() !== -1)
1003 */ 1004
1004 } //value: function () { 1005 } //value: function () {
1005 }, //HandleDoubleClick: { 1006 }, //HandleDoubleClick: {
1006 1007