diff options
-rwxr-xr-x | js/components/tools-properties/brush-properties.reel/brush-properties.html | 25 | ||||
-rwxr-xr-x | js/components/tools-properties/brush-properties.reel/brush-properties.js | 30 | ||||
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 25 | ||||
-rwxr-xr-x | js/data/pi/pi-data.js | 139 | ||||
-rwxr-xr-x | js/lib/geom/brush-stroke.js | 205 | ||||
-rw-r--r-- | js/tools/BrushTool.js | 40 | ||||
-rwxr-xr-x | js/tools/PenTool.js | 26 |
7 files changed, 370 insertions, 120 deletions
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 608111bd..98442164 100755 --- a/js/components/tools-properties/brush-properties.reel/brush-properties.html +++ b/js/components/tools-properties/brush-properties.reel/brush-properties.html | |||
@@ -33,7 +33,8 @@ | |||
33 | "maxValue": 100, | 33 | "maxValue": 100, |
34 | "value": 100, | 34 | "value": 100, |
35 | "decimalPlace": 10, | 35 | "decimalPlace": 10, |
36 | "acceptableUnits" : ["px", "pt"] | 36 | "acceptableUnits" : ["%"], |
37 | "units" : "%" | ||
37 | } | 38 | } |
38 | }, | 39 | }, |
39 | 40 | ||
@@ -46,7 +47,20 @@ | |||
46 | "maxValue": 90, | 47 | "maxValue": 90, |
47 | "value": 0, | 48 | "value": 0, |
48 | "decimalPlace": 10, | 49 | "decimalPlace": 10, |
49 | "acceptableUnits" : ["px", "pt"] | 50 | "acceptableUnits" : ["deg."], |
51 | "units" : "deg." | ||
52 | } | ||
53 | }, | ||
54 | |||
55 | "smoothingAmountHT": { | ||
56 | "module": "js/components/hottext.reel", | ||
57 | "name": "HotText", | ||
58 | "properties": { | ||
59 | "element": {"#": "smoothingAmount"}, | ||
60 | "minValue": 0, | ||
61 | "maxValue": 100, | ||
62 | "value": 0, | ||
63 | "decimalPlace": 10 | ||
50 | } | 64 | } |
51 | }, | 65 | }, |
52 | 66 | ||
@@ -58,8 +72,10 @@ | |||
58 | "_strokeSize": {"@": "strokeSizeHT"}, | 72 | "_strokeSize": {"@": "strokeSizeHT"}, |
59 | "_strokeHardness": {"@": "strokeHardnessHT"}, | 73 | "_strokeHardness": {"@": "strokeHardnessHT"}, |
60 | "_doSmoothing": {"#": "doSmoothing"}, | 74 | "_doSmoothing": {"#": "doSmoothing"}, |
75 | "_smoothingAmount": {"@": "smoothingAmountHT"}, | ||
61 | "_useCalligraphic":{"#": "useCalligraphic"}, | 76 | "_useCalligraphic":{"#": "useCalligraphic"}, |
62 | "_strokeAngle": {"@": "strokeAngleHT"} | 77 | "_strokeAngle": {"@": "strokeAngleHT"}, |
78 | "_angleLabel": {"#": "angleLabel"} | ||
63 | } | 79 | } |
64 | } | 80 | } |
65 | } | 81 | } |
@@ -75,8 +91,9 @@ | |||
75 | <label class="label"> Hardness:</label> | 91 | <label class="label"> Hardness:</label> |
76 | <div id="strokeHardness" class="label"></div> | 92 | <div id="strokeHardness" class="label"></div> |
77 | <label class="label"><input id="doSmoothing" type="checkbox" name="doSmoothingControl" class="checkBoxAlign"/>Smoothing</label> | 93 | <label class="label"><input id="doSmoothing" type="checkbox" name="doSmoothingControl" class="checkBoxAlign"/>Smoothing</label> |
94 | <div id="smoothingAmount" class="label"></div> | ||
78 | <label class="label"><input id="useCalligraphic" type="checkbox" name="useCalligraphicControl" class="checkBoxAlign"/>Calligraphic</label> | 95 | <label class="label"><input id="useCalligraphic" type="checkbox" name="useCalligraphicControl" class="checkBoxAlign"/>Calligraphic</label> |
79 | <label class="label"> Angle:</label> | 96 | <label class="label" id="angleLabel"> Angle:</label> |
80 | <div id="strokeAngle" class="label"></div> | 97 | <div id="strokeAngle" class="label"></div> |
81 | 98 | ||
82 | </div> | 99 | </div> |
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 e6faa0f0..fdcd50f8 100755 --- a/js/components/tools-properties/brush-properties.reel/brush-properties.js +++ b/js/components/tools-properties/brush-properties.reel/brush-properties.js | |||
@@ -9,6 +9,33 @@ var Component = require("montage/ui/component").Component; | |||
9 | var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties; | 9 | var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties; |
10 | 10 | ||
11 | exports.BrushProperties = Montage.create(ToolProperties, { | 11 | exports.BrushProperties = Montage.create(ToolProperties, { |
12 | _subPrepare: { | ||
13 | value: function() { | ||
14 | this.handleChange(null); | ||
15 | this._useCalligraphic.addEventListener("change", this, false); | ||
16 | this._doSmoothing.addEventListener("change", this, false); | ||
17 | } | ||
18 | }, | ||
19 | handleChange: { | ||
20 | value: function(event) { | ||
21 | if(this._useCalligraphic.checked) { | ||
22 | this._strokeAngle.element.style["display"] = ""; | ||
23 | this._strokeAngle.visible = true; | ||
24 | this._angleLabel.style["display"] = ""; | ||
25 | } else { | ||
26 | this._strokeAngle.element.style["display"] = "none"; | ||
27 | this._strokeAngle.visible = false; | ||
28 | this._angleLabel.style["display"] = "none"; | ||
29 | } | ||
30 | if(this._doSmoothing.checked) { | ||
31 | this._smoothingAmount.element.style["display"] = ""; | ||
32 | this._smoothingAmount.visible = true; | ||
33 | } else { | ||
34 | this._smoothingAmount.element.style["display"] = "none"; | ||
35 | this._smoothingAmount.visible = false; | ||
36 | } | ||
37 | } | ||
38 | }, | ||
12 | strokeSize: { | 39 | strokeSize: { |
13 | get: function() { return this._strokeSize; } | 40 | get: function() { return this._strokeSize; } |
14 | }, | 41 | }, |
@@ -18,6 +45,9 @@ exports.BrushProperties = Montage.create(ToolProperties, { | |||
18 | doSmoothing:{ | 45 | doSmoothing:{ |
19 | get: function() {return this._doSmoothing.checked; } | 46 | get: function() {return this._doSmoothing.checked; } |
20 | }, | 47 | }, |
48 | smoothingAmount:{ | ||
49 | get: function() {return this._smoothingAmount;} | ||
50 | }, | ||
21 | useCalligraphic: { | 51 | useCalligraphic: { |
22 | get: function() {return this._useCalligraphic.checked;} | 52 | get: function() {return this._useCalligraphic.checked;} |
23 | }, | 53 | }, |
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index d72d9c14..b273350a 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -100,6 +100,31 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
100 | el.elementModel.shapeModel.GLWorld.render(); | 100 | el.elementModel.shapeModel.GLWorld.render(); |
101 | } | 101 | } |
102 | break; | 102 | break; |
103 | case "strokeHardness": | ||
104 | this.setShapeProperty(el, "strokeHardness", value); | ||
105 | el.elementModel.shapeModel.GLGeomObj.setStrokeHardness(val); | ||
106 | el.elementModel.shapeModel.GLWorld.render(); | ||
107 | break; | ||
108 | case "strokeSmoothing": | ||
109 | this.setShapeProperty(el, "strokeSmoothing", value); | ||
110 | el.elementModel.shapeModel.GLGeomObj.setSmoothingAmount(val); | ||
111 | el.elementModel.shapeModel.GLWorld.render(); | ||
112 | break; | ||
113 | case "doSmoothing": | ||
114 | this.setShapeProperty(el, "doSmoothing", value); | ||
115 | el.elementModel.shapeModel.GLGeomObj.setDoSmoothing(value); | ||
116 | el.elementModel.shapeModel.GLWorld.render(); | ||
117 | break; | ||
118 | case "isCalligraphic": | ||
119 | this.setShapeProperty(el, "isCalligraphic", value); | ||
120 | el.elementModel.shapeModel.GLGeomObj.setStrokeUseCalligraphic(value); | ||
121 | el.elementModel.shapeModel.GLWorld.render(); | ||
122 | break; | ||
123 | case "strokeAngle": | ||
124 | this.setShapeProperty(el, "strokeAngle", value); | ||
125 | el.elementModel.shapeModel.GLGeomObj.setStrokeAngle(Math.PI * -val/180); | ||
126 | el.elementModel.shapeModel.GLWorld.render(); | ||
127 | break; | ||
103 | default: | 128 | default: |
104 | CanvasController.setProperty(el, p, value); | 129 | CanvasController.setProperty(el, p, value); |
105 | } | 130 | } |
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js index ba03c347..ebd15832 100755 --- a/js/data/pi/pi-data.js +++ b/js/data/pi/pi-data.js | |||
@@ -585,7 +585,144 @@ exports.PiData = Montage.create( Montage, { | |||
585 | ] | 585 | ] |
586 | } | 586 | } |
587 | ] | 587 | ] |
588 | } | 588 | }, |
589 | SubpathPi: { | ||
590 | value: [ | ||
591 | { | ||
592 | label: "Stroke", | ||
593 | |||
594 | Section: [ | ||
595 | [ | ||
596 | { | ||
597 | type : "color", | ||
598 | prop: "border", | ||
599 | id : "stroke" | ||
600 | }, | ||
601 | { | ||
602 | type : "color", | ||
603 | id : "fill", | ||
604 | prop: "background", | ||
605 | divider : true | ||
606 | } | ||
607 | ], | ||
608 | [ | ||
609 | { | ||
610 | type : "hottext", | ||
611 | id : "strokeSize", | ||
612 | prop : "strokeSize", | ||
613 | label : "Stroke", | ||
614 | valueMutator: parseFloat, | ||
615 | min : 1, | ||
616 | max : 100, | ||
617 | value : 1, | ||
618 | unit : "px", | ||
619 | acceptableUnits: ["pt", "px"] | ||
620 | } | ||
621 | ] | ||
622 | ] | ||
623 | } | ||