aboutsummaryrefslogtreecommitdiff
path: root/js/tools/PenTool.js
diff options
context:
space:
mode:
authorEric Guzman2012-04-02 15:36:08 -0700
committerEric Guzman2012-04-02 15:36:08 -0700
commit0241bf331b7e06e206a54be441edf2f4c7261f63 (patch)
treeb7e2f9cad73eed4fc616cf1841cd0be02bd955d4 /js/tools/PenTool.js
parentdde5b5054f93db493e5d4d502e677f5781334b08 (diff)
parentc6de22bf42be90b403491b5f87b1818d9020310c (diff)
downloadninja-0241bf331b7e06e206a54be441edf2f4c7261f63.tar.gz
Merge branch 'refs/heads/master' into CSSPanelUpdates
Diffstat (limited to 'js/tools/PenTool.js')
-rwxr-xr-xjs/tools/PenTool.js33
1 files changed, 30 insertions, 3 deletions
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index 60ef4f92..779b7f16 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -467,9 +467,9 @@ exports.PenTool = Montage.create(ShapeTool, {
467 if (this.application.ninja.colorController.colorToolbar.stroke.webGlColor){ 467 if (this.application.ninja.colorController.colorToolbar.stroke.webGlColor){
468 this._selectedSubpath.setStrokeColor(this.application.ninja.colorController.colorToolbar.stroke.webGlColor); 468 this._selectedSubpath.setStrokeColor(this.application.ninja.colorController.colorToolbar.stroke.webGlColor);
469 } 469 }
470 //if (this.application.ninja.colorController.colorToolbar.fill.webGlColor){ 470 if (this.application.ninja.colorController.colorToolbar.fill.webGlColor){
471 // this._selectedSubpath.setFillColor(this.application.ninja.colorController.colorToolbar.fill.webGlColor); 471 this._selectedSubpath.setFillColor(this.application.ninja.colorController.colorToolbar.fill.webGlColor);
472 //} 472 }
473 } //if this is a new path being rendered 473 } //if this is a new path being rendered
474 474
475 this._selectedSubpath.makeDirty(); 475 this._selectedSubpath.makeDirty();
@@ -594,6 +594,7 @@ exports.PenTool = Montage.create(ShapeTool, {
594 594
595 var subpath = this._selectedSubpath; //new GLSubpath(); 595 var subpath = this._selectedSubpath; //new GLSubpath();
596 subpath.setWorld(world); 596 subpath.setWorld(world);
597 subpath.setCanvas(newCanvas);
597 subpath.setPlaneMatrix(planeMat); 598 subpath.setPlaneMatrix(planeMat);
598 var planeMatInv = glmat4.inverse( planeMat, [] ); 599 var planeMatInv = glmat4.inverse( planeMat, [] );
599 subpath.setPlaneMatrixInverse(planeMatInv); 600 subpath.setPlaneMatrixInverse(planeMatInv);
@@ -601,7 +602,33 @@ exports.PenTool = Montage.create(ShapeTool, {
601 602
602 world.addObject(subpath); 603 world.addObject(subpath);
603 world.render(); 604 world.render();
605 //TODO this will not work if there are multiple shapes in the same canvas
604 newCanvas.elementModel.shapeModel.GLGeomObj = subpath; 606 newCanvas.elementModel.shapeModel.GLGeomObj = subpath;
607 newCanvas.elementModel.shapeModel.shapeCount++;
608 if(newCanvas.elementModel.shapeModel.shapeCount === 1)
609 {
610 newCanvas.elementModel.selection = "Subpath";
611 newCanvas.elementModel.pi = "SubpathPi";
612 newCanvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units;
613 var strokeColor = subpath.getStrokeColor();
614 newCanvas.elementModel.shapeModel.stroke = strokeColor;
615 if(strokeColor) {
616 newCanvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke;
617 }
618 newCanvas.elementModel.shapeModel.strokeMaterial = subpath.getStrokeMaterial();
619
620 newCanvas.elementModel.shapeModel.GLGeomObj = subpath;
621 newCanvas.elementModel.shapeModel.useWebGl = this.options.use3D;
622 }
623 else
624 {
625 // TODO - update the shape's info only. shapeModel will likely need an array of shapes.
626 }
627
628 if(newCanvas.elementModel.isShape)
629 {
630 this.application.ninja.selectionController.selectElement(newCanvas);
631 }
605 } //if (!canvas) { 632 } //if (!canvas) {
606 else { 633 else {
607 634