aboutsummaryrefslogtreecommitdiff
path: root/js/tools/PenTool.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-04-02 10:40:05 -0700
committerJose Antonio Marquez2012-04-02 10:40:05 -0700
commitb2f6ec0a6b08edac76cc77e1b57009bbb319abf5 (patch)
treecb24d3a9db06d3ffc538f3558436f7bce29aa7fd /js/tools/PenTool.js
parente876941eaa6cf5adf0e028d0f3f9402284ea5de2 (diff)
parentc6de22bf42be90b403491b5f87b1818d9020310c (diff)
downloadninja-b2f6ec0a6b08edac76cc77e1b57009bbb319abf5.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into Document
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