aboutsummaryrefslogtreecommitdiff
path: root/js/mediators/keyboard-mediator.js
diff options
context:
space:
mode:
authorJon Reid2012-05-22 10:40:40 -0700
committerJon Reid2012-05-22 10:40:40 -0700
commitd43a3179171a9f82c7a17425ec69ff0a4d571f10 (patch)
tree1c78ccc588f04bac9bff4de82e527a128162cf4f /js/mediators/keyboard-mediator.js
parent1324301feea23f9d66c9ca2f52e004b552e9ed96 (diff)
parent0b6dfbbc7f6c0a67bd415ee8d64685b3f209edfa (diff)
downloadninja-d43a3179171a9f82c7a17425ec69ff0a4d571f10.tar.gz
Merge remote-tracking branch 'ninja-jduran/TimelineUber' into timeline-local
Diffstat (limited to 'js/mediators/keyboard-mediator.js')
-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 f8934669..029c0916 100755
--- a/js/mediators/keyboard-mediator.js
+++ b/js/mediators/keyboard-mediator.js
@@ -110,35 +110,35 @@ exports.KeyboardMediator = Montage.create(Component, {
110 // Shortcut for Selection Tool is V 110 // Shortcut for Selection Tool is V
111 if(evt.keyCode === Keyboard.V) { 111 if(evt.keyCode === Keyboard.V) {
112 evt.preventDefault(); 112 evt.preventDefault();
113 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[0]}); 113 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.selectionToolIndex] });
114 return; 114 return;
115 } 115 }
116 116
117 // Shortcut for Tag Tool is D 117 // Shortcut for Tag Tool is D
118 if(evt.keyCode === Keyboard.D){ 118 if(evt.keyCode === Keyboard.D){
119 evt.preventDefault(); 119 evt.preventDefault();
120 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[4]}); 120 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.tagToolIndex] });
121 return; 121 return;
122 } 122 }
123 123
124 // Shortcut for Rotate Tool is W 124 // Shortcut for Rotate Tool is W
125 if(evt.keyCode === Keyboard.W){ 125 if(evt.keyCode === Keyboard.W){
126 evt.preventDefault(); 126 evt.preventDefault();
127 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[2]}); 127 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.rotate3DToolIndex] });
128 return; 128 return;
129 } 129 }
130 130
131 // Shortcut for Translate Tool is G 131 // Shortcut for Translate Tool is G
132 if(evt.keyCode === Keyboard.G){ 132 if(evt.keyCode === Keyboard.G){
133 evt.preventDefault(); 133 evt.preventDefault();
134 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[3]}); 134 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.translate3DToolIndex] });
135 return; 135 return;
136 } 136 }
137 137
138 // shortcut for Pen tool is P 138 // shortcut for Pen tool is P
139 if (evt.keyCode === Keyboard.P){ 139 if (evt.keyCode === Keyboard.P){
140 evt.preventDefault(); 140 evt.preventDefault();
141 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[5]}); 141 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.penToolIndex] });
142 return; 142 return;
143 } 143 }
144 144
@@ -147,24 +147,24 @@ exports.KeyboardMediator = Montage.create(Component, {
147 // If the user is pressing the command key, they want to refresh the browser. 147 // If the user is pressing the command key, they want to refresh the browser.
148 if((evt.keyCode === Keyboard.R) && !evt.metaKey) { 148 if((evt.keyCode === Keyboard.R) && !evt.metaKey) {
149 evt.preventDefault(); 149 evt.preventDefault();
150 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[7]}); 150 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.shapeToolIndex] });
151 this.application.ninja.handleSelectSubTool({"detail": this.application.ninja.toolsData.defaultToolsData[7].subtools[1]}); 151 this.application.ninja.handleSelectSubTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.shapeToolIndex].subtools[1] });
152 return; 152 return;
153 } 153 }
154 154
155 // Shortcut for Oval Tool is O 155 // Shortcut for Oval Tool is O
156 if(evt.keyCode === Keyboard.O) { 156 if(evt.keyCode === Keyboard.O) {
157 evt.preventDefault(); 157 evt.preventDefault();
158 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[7]}); 158 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.shapeToolIndex] });
159 this.application.ninja.handleSelectSubTool({"detail": this.application.ninja.toolsData.defaultToolsData[7].subtools[0]}); 159 this.application.ninja.handleSelectSubTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.shapeToolIndex].subtools[0] });
160 return; 160 return;
161 } 161 }
162 162
163 // Shortcut for Line Tool is L 163 // Shortcut for Line Tool is L
164 if(evt.keyCode === Keyboard.L ) { 164 if(evt.keyCode === Keyboard.L ) {
165 evt.preventDefault(); 165 evt.preventDefault();
166 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[7]}); 166 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.shapeToolIndex] });
167 this.application.ninja.handleSelectSubTool({"detail": this.application.ninja.toolsData.defaultToolsData[7].subtools[2]}); 167 this.application.ninja.handleSelectSubTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.shapeToolIndex].subtools[2] });
168 return; 168 return;
169 } 169 }
170 170
@@ -172,38 +172,33 @@ exports.KeyboardMediator = Montage.create(Component, {
172 if(evt.keyCode === Keyboard.K ) { 172 if(evt.keyCode === Keyboard.K ) {
173 evt.preventDefault(); 173 evt.preventDefault();
174 if(this.application.ninja.toolsData.selectedTool.id === "FillTool") { 174 if(this.application.ninja.toolsData.selectedTool.id === "FillTool") {
175 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[11]}); 175 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.inkBottleToolIndex] });
176 } else if(this.application.ninja.toolsData.selectedTool.id === "InkBottleTool") {
177 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.fillToolIndex] });
176 } else { 178 } else {
177 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[10]}); 179 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.fillToolIndex] });
178 } 180 }
179 return; 181 return;
180 }
181
182 // Shortcut for Eyedropper Tool is I
183 if(evt.keyCode === Keyboard.I && !(evt.ctrlKey || evt.metaKey)) {
184 evt.preventDefault();
185 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[12]});
186 return;
187 } 182 }
188 183
189 // Rotate Stage Tool is M 184 // Rotate Stage Tool is M
190 if(evt.keyCode === Keyboard.M ) { 185 if(evt.keyCode === Keyboard.M ) {
191 evt.preventDefault(); 186 evt.preventDefault();
192 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[13]}); 187 this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.rotateStage3DToolIndex] });
193 return; 188 return;
194 } 189 }
195 190
196 // Hand tool 191 // Hand tool
197 if(evt.keyCode === Keyboard.H ) { 192 if(evt.keyCode === Keyboard.H ) {
198 evt.preventDefault(); 193 evt.preventDefault();
199 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[14]}); 194 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.panToolIndex]});
200 return; 195 return;
201 } 196 }
202 197
203 // Zoom tool 198 // Zoom tool
204 if((evt.keyCode === Keyboard.Z) && !(evt.ctrlKey || evt.metaKey) && !evt.shiftKey) {//ctrl or shift key not press with Z 199 if((evt.keyCode === Keyboard.Z) && !(evt.ctrlKey || evt.metaKey) && !evt.shiftKey) {//ctrl or shift key not press with Z
205 evt.preventDefault(); 200 evt.preventDefault();
206 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[15]}); 201 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.zoomToolIndex]});
207 return; 202 return;
208 } 203 }
209 204