aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-05-16 16:23:05 -0700
committerJose Antonio Marquez2012-05-16 16:23:05 -0700
commitd59cb51c275fbbef84604f9ed77afedba8168099 (patch)
tree7d3f51c20eb6b6940c1ce648d828fa1e2d8d510b /js/mediators
parent857aafee732b6a85fa155ff4a05d1b8fde48f09d (diff)
parent92fcb770aff434e994e7a39a61d8fac4a017dca0 (diff)
downloadninja-d59cb51c275fbbef84604f9ed77afedba8168099.tar.gz
Merge branch 'refs/heads/Ninja-DOM-Architecture' into Document
Diffstat (limited to 'js/mediators')
-rwxr-xr-xjs/mediators/keyboard-mediator.js43
1 files changed, 19 insertions, 24 deletions
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js
index 243caf5c..23a2ce75 100755
--- a/js/mediators/keyboard-mediator.js
+++ b/js/mediators/keyboard-mediator.js
@@ -111,35 +111,35 @@ exports.KeyboardMediator = Montage.create(Component, {
111 // Shortcut for Selection Tool is V 111 // Shortcut for Selection Tool is V
112 if(evt.keyCode === Keyboard.V) { 112 if(evt.keyCode === Keyboard.V) {
113 evt.preventDefault(); 113 evt.preventDefault();
114 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[0]}); 114 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.selectionToolIndex] });
115 return; 115 return;
116 } 116 }
117 117
118 // Shortcut for Tag Tool is D 118 // Shortcut for Tag Tool is D
119 if(evt.keyCode === Keyboard.D){ 119 if(evt.keyCode === Keyboard.D){
120 evt.preventDefault(); 120 evt.preventDefault();
121 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[4]}); 121 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.tagToolIndex] });
122 return; 122 return;
123 } 123 }
124 124
125 // Shortcut for Rotate Tool is W 125 // Shortcut for Rotate Tool is W
126 if(evt.keyCode === Keyboard.W){ 126 if(evt.keyCode === Keyboard.W){
127 evt.preventDefault(); 127 evt.preventDefault();
128 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[2]}); 128 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.rotate3DToolIndex] });
129 return; 129 return;
130 } 130 }
131 131
132 // Shortcut for Translate Tool is G 132 // Shortcut for Translate Tool is G
133 if(evt.keyCode === Keyboard.G){ 133 if(evt.keyCode === Keyboard.G){
134 evt.preventDefault(); 134 evt.preventDefault();
135 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[3]}); 135 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.translate3DToolIndex] });
136 return; 136 return;
137 } 137 }
138 138
139 // shortcut for Pen tool is P 139 // shortcut for Pen tool is P
140 if (evt.keyCode === Keyboard.P){ 140 if (evt.keyCode === Keyboard.P){
141 evt.preventDefault(); 141 evt.preventDefault();
142 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[5]}); 142 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.penToolIndex] });
143 return; 143 return;
144 } 144 }
145 145
@@ -148,24 +148,24 @@ exports.KeyboardMediator = Montage.create(Component, {
148 // If the user is pressing the command key, they want to refresh the browser. 148 // If the user is pressing the command key, they want to refresh the browser.
149 if((evt.keyCode === Keyboard.R) && !evt.metaKey) { 149 if((evt.keyCode === Keyboard.R) && !evt.metaKey) {
150 evt.preventDefault(); 150 evt.preventDefault();
151 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[7]}); 151 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.shapeToolIndex] });
152 this.application.ninja.handleSelectSubTool({"detail": this.application.ninja.toolsData.defaultToolsData[7].subtools[1]}); 152 this.application.ninja.handleSelectSubTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.shapeToolIndex].subtools[1] });
153 return; 153 return;
154 } 154 }
155 155
156 // Shortcut for Oval Tool is O 156 // Shortcut for Oval Tool is O
157 if(evt.keyCode === Keyboard.O) { 157 if(evt.keyCode === Keyboard.O) {
158 evt.preventDefault(); 158 evt.preventDefault();
159 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[7]}); 159 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.shapeToolIndex] });
160 this.application.ninja.handleSelectSubTool({"detail": this.application.ninja.toolsData.defaultToolsData[7].subtools[0]}); 160 this.application.ninja.handleSelectSubTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.shapeToolIndex].subtools[0] });
161 return; 161 return;
162 } 162 }
163 163
164 // Shortcut for Line Tool is L 164 // Shortcut for Line Tool is L
165 if(evt.keyCode === Keyboard.L ) { 165 if(evt.keyCode === Keyboard.L ) {
166 evt.preventDefault(); 166 evt.preventDefault();
167 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[7]}); 167 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.shapeToolIndex] });
168 this.application.ninja.handleSelectSubTool({"detail": this.application.ninja.toolsData.defaultToolsData[7].subtools[2]}); 168 this.application.ninja.handleSelectSubTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.shapeToolIndex].subtools[2] });
169 return; 169 return;
170 } 170 }
171 171
@@ -173,38 +173,33 @@ exports.KeyboardMediator = Montage.create(Component, {
173 if(evt.keyCode === Keyboard.K ) { 173 if(evt.keyCode === Keyboard.K ) {
174 evt.preventDefault(); 174 evt.preventDefault();
175 if(this.application.ninja.toolsData.selectedTool.id === "FillTool") { 175 if(this.application.ninja.toolsData.selectedTool.id === "FillTool") {
176 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[11]}); 176 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.inkBottleToolIndex] });
177 } else if(this.application.ninja.toolsData.selectedTool.id === "InkBottleTool") {
178 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.fillToolIndex] });
177 } else { 179 } else {
178 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[10]}); 180 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.fillToolIndex] });
179 } 181 }
180 return; 182 return;
181 }
182
183 // Shortcut for Eyedropper Tool is I
184 if(evt.keyCode === Keyboard.I && !(evt.ctrlKey || evt.metaKey)) {
185 evt.preventDefault();
186 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[12]});
187 return;
188 } 183 }
189 184
190 // Rotate Stage Tool is M 185 // Rotate Stage Tool is M
191 if(evt.keyCode === Keyboard.M ) { 186 if(evt.keyCode === Keyboard.M ) {
192 evt.preventDefault(); 187 evt.preventDefault();
193 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[13]}); 188 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.rotateStage3DToolIndex] });
194 return; 189 return;
195 } 190 }
196 191
197 // Hand tool 192 // Hand tool
198 if(evt.keyCode === Keyboard.H ) { 193 if(evt.keyCode === Keyboard.H ) {
199 evt.preventDefault(); 194 evt.preventDefault();
200 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[14]}); 195 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.panToolIndex]});
201 return; 196 return;
202 } 197 }
203 198
204 // Zoom tool 199 // Zoom tool
205 if((evt.keyCode === Keyboard.Z) && !(evt.ctrlKey || evt.metaKey) && !evt.shiftKey) {//ctrl or shift key not press with Z 200 if((evt.keyCode === Keyboard.Z) && !(evt.ctrlKey || evt.metaKey) && !evt.shiftKey) {//ctrl or shift key not press with Z
206 evt.preventDefault(); 201 evt.preventDefault();
207 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[15]}); 202 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.zoomToolIndex]});
208 return; 203 return;
209 } 204 }
210 205