aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--images/cursors/penCursors/Pen_.pngbin0 -> 182 bytes
-rw-r--r--images/cursors/penCursors/Pen_anchorSelect.pngbin0 -> 268 bytes
-rw-r--r--images/cursors/penCursors/Pen_append.pngbin0 -> 210 bytes
-rw-r--r--images/cursors/penCursors/Pen_closePath.pngbin0 -> 211 bytes
-rw-r--r--images/cursors/penCursors/Pen_minus.pngbin0 -> 204 bytes
-rw-r--r--images/cursors/penCursors/Pen_newPath.pngbin0 -> 215 bytes
-rw-r--r--images/cursors/penCursors/Pen_plus.pngbin0 -> 211 bytes
-rw-r--r--images/cursors/penCursors/penAdd_OLD.png (renamed from images/cursors/penAdd.png)bin3043 -> 3043 bytes
-rwxr-xr-xjs/components/tools-properties/brush-properties.reel/brush-properties.html2
-rwxr-xr-xjs/components/tools-properties/pen-properties.reel/pen-properties.html2
-rwxr-xr-xjs/document/html-document.js4
-rwxr-xr-xjs/helper-classes/3D/view-utils.js1
-rwxr-xr-xjs/lib/drawing/world.js7
-rwxr-xr-xjs/lib/geom/brush-stroke.js16
-rwxr-xr-xjs/lib/geom/sub-path.js504
-rwxr-xr-xjs/tools/PenTool.js362
16 files changed, 577 insertions, 321 deletions
diff --git a/images/cursors/penCursors/Pen_.png b/images/cursors/penCursors/Pen_.png
new file mode 100644
index 00000000..fea41116
--- /dev/null
+++ b/images/cursors/penCursors/Pen_.png
Binary files differ
diff --git a/images/cursors/penCursors/Pen_anchorSelect.png b/images/cursors/penCursors/Pen_anchorSelect.png
new file mode 100644
index 00000000..c05c2312
--- /dev/null
+++ b/images/cursors/penCursors/Pen_anchorSelect.png
Binary files differ
diff --git a/images/cursors/penCursors/Pen_append.png b/images/cursors/penCursors/Pen_append.png
new file mode 100644
index 00000000..1dbb959f
--- /dev/null
+++ b/images/cursors/penCursors/Pen_append.png
Binary files differ
diff --git a/images/cursors/penCursors/Pen_closePath.png b/images/cursors/penCursors/Pen_closePath.png
new file mode 100644
index 00000000..8447ddbc
--- /dev/null
+++ b/images/cursors/penCursors/Pen_closePath.png
Binary files differ
diff --git a/images/cursors/penCursors/Pen_minus.png b/images/cursors/penCursors/Pen_minus.png
new file mode 100644
index 00000000..41fe47d8
--- /dev/null
+++ b/images/cursors/penCursors/Pen_minus.png
Binary files differ
diff --git a/images/cursors/penCursors/Pen_newPath.png b/images/cursors/penCursors/Pen_newPath.png
new file mode 100644
index 00000000..547731f3
--- /dev/null
+++ b/images/cursors/penCursors/Pen_newPath.png
Binary files differ
diff --git a/images/cursors/penCursors/Pen_plus.png b/images/cursors/penCursors/Pen_plus.png
new file mode 100644
index 00000000..192c71fe
--- /dev/null
+++ b/images/cursors/penCursors/Pen_plus.png
Binary files differ
diff --git a/images/cursors/penAdd.png b/images/cursors/penCursors/penAdd_OLD.png
index c306cc85..c306cc85 100644
--- a/images/cursors/penAdd.png
+++ b/images/cursors/penCursors/penAdd_OLD.png
Binary files differ
diff --git a/js/components/tools-properties/brush-properties.reel/brush-properties.html b/js/components/tools-properties/brush-properties.reel/brush-properties.html
index 98442164..d9c35dc2 100755
--- a/js/components/tools-properties/brush-properties.reel/brush-properties.html
+++ b/js/components/tools-properties/brush-properties.reel/brush-properties.html
@@ -84,7 +84,7 @@
84 </head> 84 </head>
85 85
86 <body> 86 <body>
87 <div id="brushProperties" class="subToolHolderPanel"> 87 <div data-montage-id="brushProperties" class="subToolHolderPanel">
88 <div id="strokesContainer" class="leftLabel" style="margin-left:25px; padding-top: 3px;"> 88 <div id="strokesContainer" class="leftLabel" style="margin-left:25px; padding-top: 3px;">
89 <label class="label"> Width:</label> 89 <label class="label"> Width:</label>
90 <div id="strokeSize" class="label"></div> 90 <div id="strokeSize" class="label"></div>
diff --git a/js/components/tools-properties/pen-properties.reel/pen-properties.html b/js/components/tools-properties/pen-properties.reel/pen-properties.html
index 74a3a747..acbedcac 100755
--- a/js/components/tools-properties/pen-properties.reel/pen-properties.html
+++ b/js/components/tools-properties/pen-properties.reel/pen-properties.html
@@ -39,7 +39,7 @@
39 </head> 39 </head>
40 40
41 <body> 41 <body>
42 <div id="penProperties" class="subToolHolderPanel"> 42 <div data-montage-id="penProperties" class="subToolHolderPanel">
43 <div id="strokesContainer" class="leftLabel" style="margin-left:25px; padding-top: 3px;"> 43 <div id="strokesContainer" class="leftLabel" style="margin-left:25px; padding-top: 3px;">
44 <label class="label"> Stroke:</label> 44 <label class="label"> Stroke:</label>
45 <div id="strokeSize" class="label"></div> 45 <div id="strokeSize" class="label"></div>
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 42a7d537..5538229c 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -345,6 +345,10 @@ exports.HTMLDocument = Montage.create(TextDocument, {
345 elementModel.pi = "BrushStrokePi"; 345 elementModel.pi = "BrushStrokePi";
346 break; 346 break;
347 347
348 case root.GEOM_TYPE_CUBIC_BEZIER:
349 elementModel.selection = "Subpath";
350 elementModel.pi = "SubpathPi";
351 break;
348 352
349 default: 353 default:
350 console.log( "geometry type not supported for file I/O, " + root.geomType()); 354 console.log( "geometry type not supported for file I/O, " + root.geomType());
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index a72b7906..f60b953a 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -242,7 +242,6 @@ exports.ViewUtils = Montage.create(Component, {
242 var worldPt = MathUtils.transformPoint( viewPt, mat ); 242 var worldPt = MathUtils.transformPoint( viewPt, mat );
243 var stageWorldPt = this.postViewToStageWorld( worldPt, elt ); 243 var stageWorldPt = this.postViewToStageWorld( worldPt, elt );
244 this.popViewportObj(); 244 this.popViewportObj();
245
246 return stageWorldPt; 245 return stageWorldPt;
247 } 246 }
248 }, 247 },
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index 5a054224..a1a5b5ae 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -943,7 +943,7 @@ World.prototype.importObjectJSON = function( jObj, parentGeomObj )
943{ 943{
944 var type = jObj.type; 944 var type = jObj.type;
945 var BrushStroke = require("js/lib/geom/brush-stroke").BrushStroke; 945 var BrushStroke = require("js/lib/geom/brush-stroke").BrushStroke;
946 946 var SubPath = require("js/lib/geom/sub-path").SubPath;
947 var obj; 947 var obj;
948 switch (type) 948 switch (type)
949 { 949 {
@@ -962,6 +962,11 @@ World.prototype.importObjectJSON = function( jObj, parentGeomObj )
962 obj.importJSON( jObj ); 962 obj.importJSON( jObj );
963 break; 963 break;
964 964
965 case 5: //cubic bezier
966 obj = new SubPath();
967 obj.importJSON(jObj);
968 break;
969
965 case 6: //brush stroke 970 case 6: //brush stroke
966 obj = new BrushStroke(); 971 obj = new BrushStroke();
967 obj.importJSON(jObj); 972 obj.importJSON(jObj);
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js
index 22209815..2a751a89 100755
--- a/js/lib/geom/brush-stroke.js
+++ b/js/lib/geom/brush-stroke.js
@@ -413,7 +413,7 @@ var BrushStroke = function GLBrushStroke() {
413 this._LocalPoints[i][1]+= halfheight; 413 this._LocalPoints[i][1]+= halfheight;
414 414
415 //store the original points 415 //store the original points
416 this._OrigLocalPoints .push([this._LocalPoints[i][0],this._LocalPoints[i][1],this._LocalPoints[i][2]]); 416 this._OrigLocalPoints.push([this._LocalPoints[i][0],this._LocalPoints[i][1],this._LocalPoints[i][2]]);
417 } 417 }
418 //update the bbox with the same adjustment as was made for the local points above 418 //update the bbox with the same adjustment as was made for the local points above
419 this._BBoxMax[0]+= halfwidth;this._BBoxMin[0]+= halfwidth; 419 this._BBoxMax[0]+= halfwidth;this._BBoxMin[0]+= halfwidth;
@@ -541,6 +541,10 @@ var BrushStroke = function GLBrushStroke() {
541 var bboxWidth = bboxMax[0] - bboxMin[0]; 541 var bboxWidth = bboxMax[0] - bboxMin[0];
542 var bboxHeight = bboxMax[1] - bboxMin[1]; 542 var bboxHeight = bboxMax[1] - bboxMin[1];
543 543
544 if (!this._canvas){
545 //set the canvas by querying the world
546 this._canvas = this.getWorld().getCanvas();
547 }
544 if (this._canvas) { 548 if (this._canvas) {
545 var newLeft = Math.round(this._stageWorldCenter[0] - 0.5 * bboxWidth); 549 var newLeft = Math.round(this._stageWorldCenter[0] - 0.5 * bboxWidth);
546 var newTop = Math.round(this._stageWorldCenter[1] - 0.5 * bboxHeight); 550 var newTop = Math.round(this._stageWorldCenter[1] - 0.5 * bboxHeight);
@@ -550,7 +554,7 @@ var BrushStroke = function GLBrushStroke() {
550 554
551 CanvasController.setProperty(this._canvas, "width", bboxWidth+"px"); 555 CanvasController.setProperty(this._canvas, "width", bboxWidth+"px");
552 CanvasController.setProperty(this._canvas, "height", bboxHeight+"px"); 556 CanvasController.setProperty(this._canvas, "height", bboxHeight+"px");
553 this._canvas.elementModel.shapeModel.GLWorld.setViewportFromCanvas(this._canvas); 557 //this._canvas.elementModel.shapeModel.GLWorld.setViewportFromCanvas(this._canvas);
554 } 558 }
555 559
556 560
@@ -662,8 +666,8 @@ var BrushStroke = function GLBrushStroke() {
662 this._copyCoordinates3D(this._OrigLocalPoints, retObject.origLocalPoints); //todo <ditto> 666 this._copyCoordinates3D(this._OrigLocalPoints, retObject.origLocalPoints); //todo <ditto>
663 667
664 retObject.stageWorldCenter = [this._stageWorldCenter[0],this._stageWorldCenter[1],this._stageWorldCenter[2]]; 668 retObject.stageWorldCenter = [this._stageWorldCenter[0],this._stageWorldCenter[1],this._stageWorldCenter[2]];
665 retObject.planeMat = [this._planeMat[0],this._planeMat[1],this._planeMat[2],this._planeMat[3]]; 669 retObject.planeMat = this._planeMat;
666 retObject.planeMatInv = [this._planeMatInv[0],this._planeMatInv[1],this._planeMatInv[2],this._planeMatInv[3]]; 670 retObject.planeMatInv = this._planeMatInv;
667 retObject.dragPlane = [this._dragPlane[0],this._dragPlane[1],this._dragPlane[2],this._dragPlane[3]]; 671 retObject.dragPlane = [this._dragPlane[0],this._dragPlane[1],this._dragPlane[2],this._dragPlane[3]];
668 672
669 //stroke appearance properties 673 //stroke appearance properties
@@ -691,8 +695,8 @@ var BrushStroke = function GLBrushStroke() {
691 this._copyCoordinates3D(jo.origLocalPoints, this._OrigLocalPoints); //todo <ditto> 695 this._copyCoordinates3D(jo.origLocalPoints, this._OrigLocalPoints); //todo <ditto>
692 696
693 this._stageWorldCenter = [jo.stageWorldCenter[0],jo.stageWorldCenter[1],jo.stageWorldCenter[2]]; 697 this._stageWorldCenter = [jo.stageWorldCenter[0],jo.stageWorldCenter[1],jo.stageWorldCenter[2]];
694 this._planeMat = [jo.planeMat[0], jo.planeMat[1],jo.planeMat[2],jo.planeMat[3]]; 698 this._planeMat = jo.planeMat;
695 this._planeMatInv = [jo.planeMatInv[0],jo.planeMatInv[1],jo.planeMatInv[2],jo.planeMatInv[3]]; 699 this._planeMatInv = jo.planeMatInv;
696 this._dragPlane = [jo.dragPlane[0],jo.dragPlane[1],jo.dragPlane[2],jo.dragPlane[3]]; 700 this._dragPlane = [jo.dragPlane[0],jo.dragPlane[1],jo.dragPlane[2],jo.dragPlane[3]];
697 701
698 //stroke appearance properties 702 //stroke appearance properties
diff --git a/js/lib/geom/sub-path.js b/js/lib/geom/sub-path.js
index 7046673e..35070915 100755
--- a/js/lib/geom/sub-path.js
+++ b/js/lib/geom/sub-path.js
@@ -12,6 +12,7 @@ var AnchorPoint = require("js/lib/geom/anchor-point").AnchorPoint;
12var MaterialsModel = require("js/models/materials-model").MaterialsModel; 12var MaterialsModel = require("js/models/materials-model").MaterialsModel;
13 13
14// TODO Those function do not seems to be used. We should remove them 14// TODO Those function do not seems to be used. We should remove them
15/*
15function SubpathOffsetPoint(pos, mapPos) { 16function SubpathOffsetPoint(pos, mapPos) {
16 this.Pos = [pos[0],pos[1],pos[2]]; 17 this.Pos = [pos[0],pos[1],pos[2]];
17 this.CurveMapPos = [mapPos[0], mapPos[1], mapPos[2]]; 18 this.CurveMapPos = [mapPos[0], mapPos[1], mapPos[2]];
@@ -33,7 +34,7 @@ function sortNumberDescending(a,b){
33function SegmentIntersections(){ 34function SegmentIntersections(){
34 this.paramArray = []; 35 this.paramArray = [];
35} 36}
36 37*/
37/////////////////////////////////////////////////////////////////////// 38///////////////////////////////////////////////////////////////////////
38// Class GLSubpath 39// Class GLSubpath
39// representation a sequence of cubic bezier curves. 40// representation a sequence of cubic bezier curves.
@@ -49,27 +50,34 @@ var GLSubpath = function GLSubpath() {
49 this._BBoxMax = [0, 0, 0]; 50 this._BBoxMax = [0, 0, 0];
50 this._isClosed = false; 51 this._isClosed = false;
51 52
52 this._samples = []; //polyline representation of this curve 53 this._samples = []; //polyline representation of this curve in stage world space
53 this._sampleParam = []; //parametric distance of samples, within [0, N], where N is # of Bezier curves (=# of anchor points if closed, =#anchor pts -1 if open) 54 this._sampleParam = []; //parametric distance of samples, within [0, N], where N is # of Bezier curves (=# of anchor points if closed, =#anchor pts -1 if open)
54 this._anchorSampleIndex = []; //index within _samples corresponding to anchor points 55 this._anchorSampleIndex = []; //index within _samples corresponding to anchor points
55 56
57 this._LocalPoints = []; //polyline representation of this curve in canvas space