aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorValerio Virgillito2012-06-05 15:20:13 -0700
committerValerio Virgillito2012-06-05 15:20:13 -0700
commitb23a684a6aba38946867463bbbf4184ba2a2ff4a (patch)
treeda14f63082178ca11c908c008d475ac2d20006c2 /js/tools
parent783097854612a292ac1be18ff15d88343013f773 (diff)
parent7b02dcf3ae97674bd8d87ad9909abcb439350b61 (diff)
downloadninja-b23a684a6aba38946867463bbbf4184ba2a2ff4a.tar.gz
Merge pull request #267 from mqg734/ToolOptions
Updated ink bottle and fill tools to support tool options checkboxes and materials.
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/FillTool.js32
-rwxr-xr-xjs/tools/InkBottleTool.js49
2 files changed, 47 insertions, 34 deletions
diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js
index 66dd9305..69807bc3 100755
--- a/js/tools/FillTool.js
+++ b/js/tools/FillTool.js
@@ -73,22 +73,28 @@ exports.FillTool = Montage.create(ModifierToolBase, {
73 this.isDrawing = true; 73 this.isDrawing = true;
74 74
75 if(this._canColor && this.application.ninja.selectedElements.length) { 75 if(this._canColor && this.application.ninja.selectedElements.length) {
76 var fillInfo = {},
77 color;
78 if(this.options.useFillColor.checked) {
79 fillInfo.colorInfo = {};
80 color = this.options.fill;
81 if(color && color.color)
82 {
83 fillInfo.colorInfo.mode = color.colorMode;
84 fillInfo.colorInfo.color = color.color;
85 } else {
86 fillInfo.colorInfo.mode = "nocolor";
87 fillInfo.colorInfo.color = null;
88 }
89 }
76 90
77 var color = this.options.fill, 91 if(this.options.useWebGL.checked) {
78 colorInfo; 92 fillInfo.webGLInfo = {};
79 if(color && color.color) 93 fillInfo.webGLInfo.material = this.options.fillMaterial.value;
80 {
81 colorInfo = { mode:color.colorMode,
82 color:color.color
83 };
84 } 94 }
85 else 95 if(fillInfo.colorInfo || fillInfo.webGLInfo) {
86 { 96 ElementsMediator.setFill(this.application.ninja.selectedElements, fillInfo, "Change", "fillTool");
87 colorInfo = { mode:"nocolor",
88 color:color.color
89 };
90 } 97 }
91 ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, true, "Change", "fillTool");
92 } 98 }
93 } 99 }
94 } 100 }
diff --git a/js/tools/InkBottleTool.js b/js/tools/InkBottleTool.js
index 2c03d133..dff0b0fa 100755
--- a/js/tools/InkBottleTool.js
+++ b/js/tools/InkBottleTool.js
@@ -69,39 +69,46 @@ exports.InkBottleTool = Montage.create(ModifierToolBase, {
69 69
70 if(this._canColor && this.application.ninja.selectedElements.length) 70 if(this._canColor && this.application.ninja.selectedElements.length)
71 { 71 {
72 var color = this.options.stroke, 72 var strokeInfo = {},
73 colorInfo; 73 color;
74 if(color && color.color) 74 if(this.options.useStrokeColor.checked) {
75 { 75 strokeInfo.colorInfo = {};
76 colorInfo = { mode:color.colorMode, 76 color = this.options.stroke;
77 color:color.color 77 if(color && color.color)
78 }; 78 {
79 } 79 strokeInfo.colorInfo.mode = color.colorMode;
80 else 80 strokeInfo.colorInfo.color = color.color;
81 { 81 } else {
82 colorInfo = { mode:"nocolor", 82 strokeInfo.colorInfo.mode = "nocolor";
83 color:color.color 83 strokeInfo.colorInfo.color = null;
84 }; 84 }
85 } 85 }
86 86
87 if(this.options.useBorderWidth.checked || this.options.useBorderStyle.checked) { 87 if(this.options.useBorderWidth.checked || this.options.useBorderStyle.checked) {
88 colorInfo.borderInfo = {}; 88 strokeInfo.borderInfo = {};
89 if(this.options.useBorderWidth.checked) { 89 if(this.options.useBorderWidth.checked) {
90 colorInfo.borderInfo.borderWidth = this.options._borderWidth.value; 90 strokeInfo.borderInfo.borderWidth = this.options.borderWidth.value;
91 colorInfo.borderInfo.borderUnits = this.options._borderWidth.units; 91 strokeInfo.borderInfo.borderUnits = this.options.borderWidth.units;
92 } 92 }
93 if(this.options.useBorderStyle.checked) { 93 if(this.options.useBorderStyle.checked) {
94 colorInfo.borderInfo.borderStyle = this.options._borderStyle.value; 94 strokeInfo.borderInfo.borderStyle = this.options.borderStyle.value;
95 } 95 }
96 } 96 }
97 97
98 if(this.options.useStrokeSize.checked) { 98 if(this.options.useStrokeSize.checked) {
99 colorInfo.strokeInfo = {}; 99 strokeInfo.shapeInfo = {};
100 colorInfo.strokeInfo.strokeSize = this.options._strokeSize.value; 100 strokeInfo.shapeInfo.strokeSize = this.options.strokeSize.value;
101 colorInfo.strokeInfo.strokeUnits = this.options._strokeSize.units; 101 strokeInfo.shapeInfo.strokeUnits = this.options.strokeSize.units;
102 }
103
104 if(this.options.useWebGL.checked) {
105 strokeInfo.webGLInfo = {};
106 strokeInfo.webGLInfo.material = this.options.strokeMaterial.value;
102 } 107 }
103 108
104 ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, false, "Change", "inkBottleTool"); 109 if(strokeInfo.colorInfo || strokeInfo.borderInfo || strokeInfo.shapeInfo || strokeInfo.webGLInfo) {
110 ElementsMediator.setStroke(this.application.ninja.selectedElements, strokeInfo, "Change", "inkBottleTool");
111 }
105 } 112 }
106 } 113 }
107 } 114 }