diff options
author | Pushkar Joshi | 2012-03-14 15:37:09 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-03-14 15:37:09 -0700 |
commit | 23baa44e0bc7bfb24e42702c1ef58bf62da083d8 (patch) | |
tree | 6efae3071b1b09e859fdefdbdac848063a22c355 | |
parent | 6023f7c8258e660388ee33730601f1161f9299e9 (diff) | |
download | ninja-23baa44e0bc7bfb24e42702c1ef58bf62da083d8.tar.gz |
PI for pen and brush strokes
-rwxr-xr-x | js/components/tools-properties/brush-properties.reel/brush-properties.html | 7 | ||||
-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 | 196 | ||||
-rw-r--r-- | js/tools/BrushTool.js | 31 | ||||
-rwxr-xr-x | js/tools/PenTool.js | 26 |
6 files changed, 311 insertions, 113 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 cbe4c242..98442164 100755 --- a/js/components/tools-properties/brush-properties.reel/brush-properties.html +++ b/js/components/tools-properties/brush-properties.reel/brush-properties.html | |||
@@ -53,15 +53,14 @@ | |||
53 | }, | 53 | }, |
54 | 54 | ||
55 | "smoothingAmountHT": { | 55 | "smoothingAmountHT": { |
56 | "module": "js/components/hottextunit.reel", | 56 | "module": "js/components/hottext.reel", |
57 | "name": "HotTextUnit", | 57 | "name": "HotText", |
58 | "properties": { | 58 | "properties": { |
59 | "element": {"#": "smoothingAmount"}, | 59 | "element": {"#": "smoothingAmount"}, |
60 | "minValue": 0, | 60 | "minValue": 0, |
61 | "maxValue": 100, | 61 | "maxValue": 100, |
62 | "value": 0, | 62 | "value": 0, |
63 | "decimalPlace": 10, | 63 | "decimalPlace": 10 |
64 | "acceptableUnits" : ["px", "pt"] | ||
65 | } | 64 | } |
66 | }, | 65 | }, |
67 | 66 | ||
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 | } | ||
624 | ] | ||
625 | }, | ||
626 | BrushStrokePi: { | ||
627 | value: [ | ||
628 | { | ||
629 | label: "Stroke", | ||
630 | |||
631 | Section: [ | ||
632 | [ | ||
633 | { | ||
634 | type : "color", | ||
635 | prop: "border", | ||
636 | id : "stroke" | ||
637 | }, | ||
638 | { | ||
639 | type : "color", | ||
640 | id : "fill", | ||
641 | prop: "background", | ||
642 | visible : false, | ||
643 | divider : true | ||
644 | } | ||
645 | ], | ||
646 | [ | ||
647 | { | ||
648 | type : "hottext", | ||
649 | id : "strokeSize", | ||
650 | prop : "strokeSize", | ||
651 | label : "Stroke", | ||
652 | valueMutator: parseFloat, | ||
653 | min : 1, | ||
654 | max : 100, | ||
655 | value : 1, | ||
656 | unit : "px", | ||
657 | acceptableUnits: ["pt", "px"] | ||
658 | }, | ||
659 | { | ||
660 | type : "hottext", | ||
661 | id : "strokeHardness", | ||
662 | prop : "strokeHardness", | ||
663 | label : "Hardness", | ||
664 | valueMutator: parseFloat, | ||
665 | min : 0, | ||
666 | max : 100, | ||
667 | value : 100, | ||
668 | unit : "%", | ||
669 | acceptableUnits: ["%"] | ||
670 | } | ||
671 | ] | ||
672 | ] | ||
673 | }, | ||
674 | { | ||
675 | label: "Smoothing", | ||
676 | Section: [ | ||
677 | [ | ||
678 | { | ||
679 | type: "checkbox", | ||
680 | id: "doSmoothing", | ||
681 | prop: "doSmoothing", | ||
682 | defaultValue: false, | ||
683 | value: "Smoothing", | ||
684 | checked: false | ||
685 | }, | ||
686 | { | ||
687 | type : "hottext", | ||
688 | id : "strokeSmoothing", | ||
689 | prop : "strokeSmoothing", | ||
690 | label : "", | ||
691 | valueMutator: parseFloat, | ||
692 | min : 0, | ||
693 | max : 100, | ||
694 | value : 0 | ||
695 | } | ||
696 | ] | ||
697 | ] | ||
698 | }, | ||
699 | { | ||
700 | label: "Calligraphic", | ||
701 | Section: [ | ||
702 | [ | ||
703 | { | ||
704 | type: "checkbox", | ||
705 | id: "isCalligraphic", | ||
706 | prop: "isCalligraphic", | ||
707 | defaultValue: false, | ||
708 | value: "Calligraphic", | ||
709 | checked: false | ||
710 | }, | ||
711 | { | ||
712 | type : "hottext", | ||
713 | id : "strokeAngle", | ||
714 | prop : "strokeAngle", | ||
715 | label : "", | ||
716 | valueMutator: parseFloat, | ||
717 | min : -90, | ||
718 | max : 90, | ||
719 | value : 0 | ||
720 | } | ||
721 | ] | ||
722 | ] | ||
723 | } | ||
724 | ] //value: [ | ||
725 | } //BrushStrokePi: { | ||
589 | }); | 726 | }); |
590 | 727 | ||
591 | 728 | ||
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js index 52f81ffe..0278e49c 100755 --- a/js/lib/geom/brush-stroke.js +++ b/js/lib/geom/brush-stroke.js | |||
@@ -18,9 +18,12 @@ var BrushStroke = function GLBrushStroke() { | |||
18 | // Instance variables | 18 | // Instance variables |
19 | /////////////////////////////////////////////////// | 19 | /////////////////////////////////////////////////// |
20 | this._Points = []; | 20 | this._Points = []; |
21 | this._OrigPoints = []; | ||
21 | this._BBoxMin = [0, 0, 0]; | 22 | this._BBoxMin = [0, 0, 0]; |
22 | this._BBoxMax = [0, 0, 0]; | 23 | this._BBoxMax = [0, 0, 0]; |