diff options
Diffstat (limited to 'js')
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 37 | ||||
-rwxr-xr-x | js/data/pi/pi-data.js | 14 | ||||
-rwxr-xr-x | js/lib/geom/brush-stroke.js | 46 | ||||
-rwxr-xr-x | js/lib/geom/sub-path.js | 16 | ||||
-rw-r--r-- | js/tools/BrushTool.js | 1 | ||||
-rwxr-xr-x | js/tools/PenTool.js | 9 |
6 files changed, 107 insertions, 16 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index b273350a..b5e63514 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -144,6 +144,43 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
144 | case "background": | 144 | case "background": |
145 | case "useWebGl": | 145 | case "useWebGl": |
146 | return this.getShapeProperty(el, p); | 146 | return this.getShapeProperty(el, p); |
147 | case "strokeHardness": | ||
148 | if (el.elementModel && el.elementModel.shapeModel){ | ||
149 | return el.elementModel.shapeModel.GLGeomObj.getStrokeHardness();; | ||
150 | } else { | ||
151 | return null; | ||
152 | } | ||
153 | break; | ||
154 | case "doSmoothing": | ||
155 | if (el.elementModel && el.elementModel.shapeModel){ | ||
156 | return el.elementModel.shapeModel.GLGeomObj.getDoSmoothing();; | ||
157 | } else { | ||
158 | return null; | ||
159 | } | ||
160 | break; | ||
161 | case "strokeSmoothing": | ||
162 | if (el.elementModel && el.elementModel.shapeModel){ | ||
163 | return el.elementModel.shapeModel.GLGeomObj.getSmoothingAmount();; | ||
164 | } else { | ||
165 | return null; | ||
166 | } | ||
167 | break; | ||
168 | case "isCalligraphic": | ||
169 | if (el.elementModel && el.elementModel.shapeModel){ | ||
170 | return el.elementModel.shapeModel.GLGeomObj.getStrokeUseCalligraphic();; | ||
171 | } else { | ||
172 | return null; | ||
173 | } | ||
174 | break; | ||
175 | case "strokeAngle": | ||
176 | if (el.elementModel && el.elementModel.shapeModel){ | ||
177 | return el.elementModel.shapeModel.GLGeomObj.getStrokeAngle();; | ||
178 | } else { | ||
179 | return null; | ||
180 | } | ||
181 | break; | ||
182 | |||
183 | |||
147 | case "strokeMaterial": | 184 | case "strokeMaterial": |
148 | case "fillMaterial": | 185 | case "fillMaterial": |
149 | var m = this.getShapeProperty(el, p); | 186 | var m = this.getShapeProperty(el, p); |
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js index ebd15832..9d90aa3d 100755 --- a/js/data/pi/pi-data.js +++ b/js/data/pi/pi-data.js | |||
@@ -680,14 +680,14 @@ exports.PiData = Montage.create( Montage, { | |||
680 | id: "doSmoothing", | 680 | id: "doSmoothing", |
681 | prop: "doSmoothing", | 681 | prop: "doSmoothing", |
682 | defaultValue: false, | 682 | defaultValue: false, |
683 | value: "Smoothing", | 683 | value: "Y/N", |
684 | checked: false | 684 | checked: false |
685 | }, | 685 | }, |
686 | { | 686 | { |
687 | type : "hottext", | 687 | type : "hottext", |
688 | id : "strokeSmoothing", | 688 | id : "strokeSmoothing", |
689 | prop : "strokeSmoothing", | 689 | prop : "strokeSmoothing", |
690 | label : "", | 690 | label : "Amount", |
691 | valueMutator: parseFloat, | 691 | valueMutator: parseFloat, |
692 | min : 0, | 692 | min : 0, |
693 | max : 100, | 693 | max : 100, |
@@ -705,18 +705,20 @@ exports.PiData = Montage.create( Montage, { | |||
705 | id: "isCalligraphic", | 705 | id: "isCalligraphic", |
706 | prop: "isCalligraphic", | 706 | prop: "isCalligraphic", |
707 | defaultValue: false, | 707 | defaultValue: false, |
708 | value: "Calligraphic", | 708 | value: "Y/N", |
709 | checked: false | 709 | checked: false, |
710 | divider : true | ||
710 | }, | 711 | }, |
711 | { | 712 | { |
712 | type : "hottext", | 713 | type : "hottext", |
713 | id : "strokeAngle", | 714 | id : "strokeAngle", |
714 | prop : "strokeAngle", | 715 | prop : "strokeAngle", |
715 | label : "", | 716 | label : "Angle", |
716 | valueMutator: parseFloat, | 717 | valueMutator: parseFloat, |
717 | min : -90, | 718 | min : -90, |
718 | max : 90, | 719 | max : 90, |
719 | value : 0 | 720 | value : 0, |
721 | unit : "deg." | ||
720 | } | 722 | } |
721 | ] | 723 | ] |
722 | ] | 724 | ] |
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js index 0278e49c..02a39ccd 100755 --- a/js/lib/geom/brush-stroke.js +++ b/js/lib/geom/brush-stroke.js | |||
@@ -4,9 +4,11 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. |
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | // Todo: This entire class should be converted to a module | ||
8 | var VecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; | 7 | var VecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; |
9 | var GeomObj = require("js/lib/geom/geom-obj").GeomObj; | 8 | var GeomObj = require("js/lib/geom/geom-obj").GeomObj; |
9 | var CanvasController = require("js/controllers/elements/canvas-controller").CanvasController; | ||
10 | |||
11 | // Todo: This entire class should be converted to a module | ||
10 | 12 | ||
11 | /////////////////////////////////////////////////////////////////////// | 13 | /////////////////////////////////////////////////////////////////////// |
12 | // Class GLBrushStroke | 14 | // Class GLBrushStroke |
@@ -28,7 +30,10 @@ var BrushStroke = function GLBrushStroke() { | |||
28 | //whether or not to use the canvas drawing to stroke/fill | 30 | //whether or not to use the canvas drawing to stroke/fill |
29 | this._useCanvasDrawing = true; | 31 | this._useCanvasDrawing = true; |
30 | 32 | ||
31 | //the X and Y location of this subpath's canvas in stage world space of Ninja | 33 | //the HTML5 canvas that holds this brush stroke |
34 | this._canvas = null; | ||
35 | |||
36 | //the X and Y location of this brush stroke canvas in stage world space of Ninja | ||
32 | this._canvasX = 0; | 37 | this._canvasX = 0; |
33 | this._canvasY = 0; | 38 | this._canvasY = 0; |
34 | 39 | ||
@@ -65,6 +70,10 @@ var BrushStroke = function GLBrushStroke() { | |||
65 | ///////////////////////////////////////////////////////// | 70 | ///////////////////////////////////////////////////////// |
66 | // Property Accessors/Setters | 71 | // Property Accessors/Setters |
67 | ///////////////////////////////////////////////////////// | 72 | ///////////////////////////////////////////////////////// |
73 | this.setCanvas = function(c) { | ||
74 | this._canvas = c; | ||
75 | } | ||
76 | |||
68 | this.setWorld = function (world) { | 77 | this.setWorld = function (world) { |
69 | this._world = world; | 78 | this._world = world; |
70 | }; | 79 | }; |
@@ -195,6 +204,9 @@ var BrushStroke = function GLBrushStroke() { | |||
195 | this._dirty = true; | 204 | this._dirty = true; |
196 | } | 205 | } |
197 | } | 206 | } |
207 | this.getStrokeHardness = function(){ | ||
208 | return this._strokeHardness; | ||
209 | } | ||
198 | 210 | ||
199 | this.setDoSmoothing = function(s){ | 211 | this.setDoSmoothing = function(s){ |
200 | if (this._strokeDoSmoothing!==s) { | 212 | if (this._strokeDoSmoothing!==s) { |
@@ -203,12 +215,19 @@ var BrushStroke = function GLBrushStroke() { | |||
203 | } | 215 | } |
204 | } | 216 | } |
205 | 217 | ||
218 | this.getDoSmoothing = function(){ | ||
219 | return this._strokeDoSmoothing; | ||
220 | } | ||
221 | |||
206 | this.setSmoothingAmount = function(a){ | 222 | this.setSmoothingAmount = function(a){ |
207 | if (this._strokeAmountSmoothing!==a) { | 223 | if (this._strokeAmountSmoothing!==a) { |
208 | this._strokeAmountSmoothing = a; | 224 | this._strokeAmountSmoothing = a; |
209 | this._dirty = true; | 225 | this._dirty = true; |
210 | } | 226 | } |
227 | } | ||
211 | 228 | ||
229 | this.getSmoothingAmount = function(){ | ||
230 | return this._strokeAmountSmoothing; | ||
212 | } | 231 | } |
213 | 232 | ||
214 | this.setStrokeUseCalligraphic = function(c){ | 233 | this.setStrokeUseCalligraphic = function(c){ |
@@ -225,6 +244,14 @@ var BrushStroke = function GLBrushStroke() { | |||
225 | }; | 244 | }; |
226 | } | 245 | } |
227 | 246 | ||
247 | this.getStrokeUseCalligraphic = function(){ | ||
248 | return this._strokeUseCalligraphic; | ||
249 | } | ||
250 | |||
251 | this.getStrokeAngle = function(){ | ||
252 | this._strokeAngle = a; | ||
253 | } | ||
254 | |||
228 | this.getStrokeStyle = function () { | 255 | this.getStrokeStyle = function () { |
229 | return this._strokeStyle; | 256 | return this._strokeStyle; |
230 | }; | 257 | }; |
@@ -301,12 +328,13 @@ var BrushStroke = function GLBrushStroke() { | |||
301 | console.log("Inserted "+numInsertedPoints+" additional CatmullRom points"); | 328 | console.log("Inserted "+numInsertedPoints+" additional CatmullRom points"); |
302 | this._addedSamples = true; | 329 | this._addedSamples = true; |
303 | this._dirty=true; | 330 | this._dirty=true; |
304 | } | 331 | } //if we need to add samples to this curve (done only once) |
332 | |||
305 | //build a copy of the original points...this should be done only once | 333 | //build a copy of the original points...this should be done only once |
306 | if (this._storedOrigPoints === false) { | 334 | if (this._storedOrigPoints === false) { |
307 | this._OrigPoints = this._Points.slice(0); | 335 | this._OrigPoints = this._Points.slice(0); |
308 | this._storedOrigPoints = true; | 336 | this._storedOrigPoints = true; |
309 | } | 337 | } //if we need to store a copy of the original points (done only once) |
310 | 338 | ||
311 | if (this._dirty) { | 339 | if (this._dirty) { |
312 | this._Points = this._OrigPoints.slice(0); | 340 | this._Points = this._OrigPoints.slice(0); |
@@ -377,7 +405,7 @@ var BrushStroke = function GLBrushStroke() { | |||
377 | 405 | ||
378 | // get the context | 406 | // get the context |
379 | var ctx = world.get2DContext(); |