aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--images/cursors/penAdd.pngbin0 -> 3043 bytes
-rwxr-xr-xjs/components/tools-properties/brush-properties.reel/brush-properties.html56
-rwxr-xr-xjs/components/tools-properties/brush-properties.reel/brush-properties.js26
-rwxr-xr-xjs/helper-classes/backup-delete/GLBrushStroke.js174
-rwxr-xr-xjs/helper-classes/backup-delete/GLSubpath.js147
-rwxr-xr-xjs/lib/geom/brush-stroke.js329
-rwxr-xr-xjs/lib/geom/sub-path.js84
-rw-r--r--js/tools/BrushTool.js41
-rwxr-xr-xjs/tools/PenTool.js12
9 files changed, 691 insertions, 178 deletions
diff --git a/images/cursors/penAdd.png b/images/cursors/penAdd.png
new file mode 100644
index 00000000..c306cc85
--- /dev/null
+++ b/images/cursors/penAdd.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 38f7f856..608111bd 100755
--- a/js/components/tools-properties/brush-properties.reel/brush-properties.html
+++ b/js/components/tools-properties/brush-properties.reel/brush-properties.html
@@ -11,12 +11,55 @@
11 11
12 <script type="text/montage-serialization"> 12 <script type="text/montage-serialization">
13 { 13 {
14 "strokeSizeHT": {
15 "module": "js/components/hottextunit.reel",
16 "name": "HotTextUnit",
17 "properties": {
18 "element": {"#": "strokeSize"},
19 "minValue": 1,
20 "maxValue": 100,
21 "value": 1,
22 "decimalPlace": 10,
23 "acceptableUnits" : ["px", "pt"]
24 }
25 },
26
27 "strokeHardnessHT": {
28 "module": "js/components/hottextunit.reel",
29 "name": "HotTextUnit",
30 "properties": {
31 "element": {"#": "strokeHardness"},
32 "minValue": 0,
33 "maxValue": 100,
34 "value": 100,
35 "decimalPlace": 10,
36 "acceptableUnits" : ["px", "pt"]
37 }
38 },
39
40 "strokeAngleHT": {
41 "module": "js/components/hottextunit.reel",
42 "name": "HotTextUnit",
43 "properties": {
44 "element": {"#": "strokeAngle"},
45 "minValue": -90,
46 "maxValue": 90,
47 "value": 0,
48 "decimalPlace": 10,
49 "acceptableUnits" : ["px", "pt"]
50 }
51 },
14 52
15 "owner": { 53 "owner": {
16 "module": "js/components/tools-properties/brush-properties.reel", 54 "module": "js/components/tools-properties/brush-properties.reel",
17 "name": "BrushProperties", 55 "name": "BrushProperties",
18 "properties": { 56 "properties": {
19 "element": {"#": "brushProperties"} 57 "element": {"#": "brushProperties"},
58 "_strokeSize": {"@": "strokeSizeHT"},
59 "_strokeHardness": {"@": "strokeHardnessHT"},
60 "_doSmoothing": {"#": "doSmoothing"},
61 "_useCalligraphic":{"#": "useCalligraphic"},
62 "_strokeAngle": {"@": "strokeAngleHT"}
20 } 63 }
21 } 64 }
22 } 65 }
@@ -26,6 +69,17 @@
26 69
27 <body> 70 <body>
28 <div id="brushProperties" class="subToolHolderPanel"> 71 <div id="brushProperties" class="subToolHolderPanel">
72 <div id="strokesContainer" class="leftLabel" style="margin-left:25px; padding-top: 3px;">
73 <label class="label"> Width:</label>
74 <div id="strokeSize" class="label"></div>
75 <label class="label"> Hardness:</label>
76 <div id="strokeHardness" class="label"></div>
77 <label class="label"><input id="doSmoothing" type="checkbox" name="doSmoothingControl" class="checkBoxAlign"/>Smoothing</label>
78 <label class="label"><input id="useCalligraphic" type="checkbox" name="useCalligraphicControl" class="checkBoxAlign"/>Calligraphic</label>
79 <label class="label"> Angle:</label>
80 <div id="strokeAngle" class="label"></div>
81
82 </div>
29 </div> 83 </div>
30 </body> 84 </body>
31 85
diff --git a/js/components/tools-properties/brush-properties.reel/brush-properties.js b/js/components/tools-properties/brush-properties.reel/brush-properties.js
index 92da98cc..e6faa0f0 100755
--- a/js/components/tools-properties/brush-properties.reel/brush-properties.js
+++ b/js/components/tools-properties/brush-properties.reel/brush-properties.js
@@ -9,17 +9,19 @@ var Component = require("montage/ui/component").Component;
9var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties; 9var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties;
10 10
11exports.BrushProperties = Montage.create(ToolProperties, { 11exports.BrushProperties = Montage.create(ToolProperties, {
12 12 strokeSize: {
13 13 get: function() { return this._strokeSize; }
14 _subPrepare: {
15 value: function() {
16 //this.divElement.addEventListener("click", this, false);
17 }
18 }, 14 },
19 15 strokeHardness: {
20 handleClick: { 16 get: function() { return this._strokeHardness; }
21 value: function(event) { 17 },
22 // this.selectedElement = event._event.target.id; 18 doSmoothing:{
23 } 19 get: function() {return this._doSmoothing.checked; }
20 },
21 useCalligraphic: {
22 get: function() {return this._useCalligraphic.checked;}
23 },
24 strokeAngle: {
25 get: function() {return this._strokeAngle;}
24 } 26 }
25}); \ No newline at end of file 27});
diff --git a/js/helper-classes/backup-delete/GLBrushStroke.js b/js/helper-classes/backup-delete/GLBrushStroke.js
index 5d773c2d..26c922a3 100755
--- a/js/helper-classes/backup-delete/GLBrushStroke.js
+++ b/js/helper-classes/backup-delete/GLBrushStroke.js
@@ -31,6 +31,8 @@ function GLBrushStroke() {
31 //stroke information 31 //stroke information
32 this._strokeWidth = 0.0; 32 this._strokeWidth = 0.0;
33 this._strokeColor = [0.4, 0.4, 0.4, 1.0]; 33 this._strokeColor = [0.4, 0.4, 0.4, 1.0];
34 this._secondStrokeColor = this._strokeColor;
35 this._strokeHardness = 100;
34 this._strokeMaterial; 36 this._strokeMaterial;
35 this._strokeStyle = "Solid"; 37 this._strokeStyle = "Solid";
36 38
@@ -39,7 +41,7 @@ function GLBrushStroke() {
39 this._WETNESS_FACTOR = 0.25; 41 this._WETNESS_FACTOR = 0.25;
40 42
41 //prevent extremely long paths that can take a long time to render 43 //prevent extremely long paths that can take a long time to render
42 this._MAX_ALLOWED_SAMPLES = 500; 44 this._MAX_ALLOWED_SAMPLES = 5000;
43 45
44 //drawing context 46 //drawing context
45 this._world = null; 47 this._world = null;
@@ -79,7 +81,7 @@ function GLBrushStroke() {
79 //add the point only if it is some epsilon away from the previous point 81 //add the point only if it is some epsilon away from the previous point
80 var numPoints = this._Points.length; 82 var numPoints = this._Points.length;
81 if (numPoints>0) { 83 if (numPoints>0) {
82 var threshold = this._WETNESS_FACTOR*this._strokeWidth; 84 var threshold = 1;//this._WETNESS_FACTOR*this._strokeWidth;
83 var prevPt = this._Points[numPoints-1]; 85 var prevPt = this._Points[numPoints-1];
84 var diffPt = [prevPt[0]-pt[0], prevPt[1]-pt[1]]; 86 var diffPt = [prevPt[0]-pt[0], prevPt[1]-pt[1]];
85 var diffPtMag = Math.sqrt(diffPt[0]*diffPt[0] + diffPt[1]*diffPt[1]); 87 var diffPtMag = Math.sqrt(diffPt[0]*diffPt[0] + diffPt[1]*diffPt[1]);
@@ -106,6 +108,8 @@ function GLBrushStroke() {
106 this.setStrokeMaterial = function (m) { this._strokeMaterial = m; } 108 this.setStrokeMaterial = function (m) { this._strokeMaterial = m; }
107 this.getStrokeColor = function () { return this._strokeColor; } 109 this.getStrokeColor = function () { return this._strokeColor; }
108 this.setStrokeColor = function (c) { this._strokeColor = c; } 110 this.setStrokeColor = function (c) { this._strokeColor = c; }
111 this.setSecondStrokeColor = function(c){this._secondStrokeColor=c;}
112 this.setStrokeHardness = function(h){this._strokeHardness=h;}
109 this.getStrokeStyle = function () { return this._strokeStyle; } 113 this.getStrokeStyle = function () { return this._strokeStyle; }
110 this.setStrokeStyle = function (s) { this._strokeStyle = s; } 114 this.setStrokeStyle = function (s) { this._strokeStyle = s; }
111 115
@@ -133,13 +137,14 @@ function GLBrushStroke() {
133 this._Points[i][2]+=tz; 137 this._Points[i][2]+=tz;
134 } 138 }
135 } 139 }
136 140
137 this.computeMetaGeometry = function(){ 141 this.computeMetaGeometry = function(){
138 if (this._dirty){ 142 if (this._dirty){
139 var numPoints = this._Points.length; 143 var numPoints = this._Points.length;
140 144
141 //**** add samples to the path if needed...linear interpolation for now 145 //**** add samples to the path if needed...linear interpolation for now
142 if (numPoints>1) { 146 //if (numPoints>1) {
147 if (0){
143 var threshold = this._WETNESS_FACTOR*this._strokeWidth; 148 var threshold = this._WETNESS_FACTOR*this._strokeWidth;
144 var prevPt = this._Points[0]; 149 var prevPt = this._Points[0];
145 var prevIndex = 0; 150 var prevIndex = 0;
@@ -171,6 +176,44 @@ function GLBrushStroke() {
171 } 176 }
172 } 177 }
173 178