diff options
Diffstat (limited to 'js/mediators')
-rwxr-xr-x | js/mediators/keyboard-mediator.js | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index f8934669..665e3ce7 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,31 @@ 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.fillToolIndex] }); |
176 | } else { | 176 | } else { |
177 | this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[10]}); | 177 | this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.inkBottleToolIndex] }); |
178 | } | 178 | } |
179 | return; | 179 | return; |
180 | } | 180 | } |
181 | 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 | } | ||
188 | |||
189 | // Rotate Stage Tool is M | 182 | // Rotate Stage Tool is M |
190 | if(evt.keyCode === Keyboard.M ) { | 183 | if(evt.keyCode === Keyboard.M ) { |
191 | evt.preventDefault(); | 184 | evt.preventDefault(); |
192 | this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[13]}); | 185 | this.application.ninja.handleSelectTool({ "detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.rotateStage3DToolIndex] }); |
193 | return; | 186 | return; |
194 | } | 187 | } |
195 | 188 | ||
196 | // Hand tool | 189 | // Hand tool |
197 | if(evt.keyCode === Keyboard.H ) { | 190 | if(evt.keyCode === Keyboard.H ) { |
198 | evt.preventDefault(); | 191 | evt.preventDefault(); |
199 | this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[14]}); | 192 | this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.panToolIndex]}); |
200 | return; | 193 | return; |
201 | } | 194 | } |
202 | 195 | ||
203 | // Zoom tool | 196 | // Zoom tool |
204 | if((evt.keyCode === Keyboard.Z) && !(evt.ctrlKey || evt.metaKey) && !evt.shiftKey) {//ctrl or shift key not press with Z | 197 | if((evt.keyCode === Keyboard.Z) && !(evt.ctrlKey || evt.metaKey) && !evt.shiftKey) {//ctrl or shift key not press with Z |
205 | evt.preventDefault(); | 198 | evt.preventDefault(); |
206 | this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[15]}); | 199 | this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.zoomToolIndex]}); |
207 | return; | 200 | return; |
208 | } | 201 | } |
209 | 202 | ||