diff options
author | hwc487 | 2012-04-19 13:01:43 -0700 |
---|---|---|
committer | hwc487 | 2012-04-19 13:01:43 -0700 |
commit | e6a20fe64574763483dc602bd759278ccf5e5e68 (patch) | |
tree | 69defe7200206f0257fe90697136fadef59d521e /js/mediators/keyboard-mediator.js | |
parent | ae7eb87564632ce7c676bd728b8ff2710ff0bb83 (diff) | |
parent | 9284c19f076dec3b47ece7dc7bcd22d74e4246c3 (diff) | |
download | ninja-e6a20fe64574763483dc602bd759278ccf5e5e68.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Conflicts:
js/lib/drawing/world.js
js/lib/geom/geom-obj.js
js/lib/rdge/materials/cloud-material.js
js/lib/rdge/materials/deform-material.js
js/lib/rdge/materials/flat-material.js
js/lib/rdge/materials/material.js
js/lib/rdge/materials/pulse-material.js
js/lib/rdge/materials/relief-tunnel-material.js
js/lib/rdge/materials/square-tunnel-material.js
js/lib/rdge/materials/star-material.js
js/lib/rdge/materials/taper-material.js
js/lib/rdge/materials/tunnel-material.js
js/lib/rdge/materials/twist-material.js
js/lib/rdge/materials/twist-vert-material.js
js/lib/rdge/materials/uber-material.js
js/lib/rdge/materials/water-material.js
js/lib/rdge/materials/z-invert-material.js
Diffstat (limited to 'js/mediators/keyboard-mediator.js')
-rwxr-xr-x | js/mediators/keyboard-mediator.js | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 65dd34cd..79967799 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js | |||
@@ -99,12 +99,11 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
99 | evt.preventDefault(); | 99 | evt.preventDefault(); |
100 | } | 100 | } |
101 | 101 | ||
102 | // Check DELETE OR BACKSPACE | 102 | // DELETE or BACKSPACE event handler - Removes the current selected elements from the DOM |
103 | if((evt.keyCode == Keyboard.BACKSPACE) || (evt.keyCode == Keyboard.DELETE)) { | 103 | if((evt.keyCode == Keyboard.BACKSPACE) || (evt.keyCode == Keyboard.DELETE)) { |
104 | evt.stopImmediatePropagation(); | 104 | evt.stopImmediatePropagation(); |
105 | evt.preventDefault(); | 105 | evt.preventDefault(); |
106 | NJevent("deleting"); | 106 | return this.application.ninja.elementMediator.removeElements(document.application.ninja.selectedElements); |
107 | return; | ||
108 | } | 107 | } |
109 | 108 | ||
110 | 109 | ||
@@ -169,6 +168,24 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
169 | return; | 168 | return; |
170 | } | 169 | } |
171 | 170 | ||
171 | // Paint Bucket Tool and Ink Bottle tools share keyboard shortcut K | ||
172 | if(evt.keyCode === Keyboard.K ) { | ||
173 | evt.preventDefault(); | ||
174 | if(this.application.ninja.toolsData.selectedTool.id === "FillTool") { | ||
175 | this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[11]}); | ||
176 | } else { | ||
177 | this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[10]}); | ||
178 | } | ||
179 | return; | ||
180 | } | ||
181 | |||
182 | // Shortcut for Eyedropper Tool is I | ||
183 | if(evt.keyCode === Keyboard.I ) { | ||
184 | evt.preventDefault(); | ||
185 | this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[12]}); | ||
186 | return; | ||
187 | } | ||
188 | |||
172 | // Rotate Stage Tool is M | 189 | // Rotate Stage Tool is M |
173 | if(evt.keyCode === Keyboard.M ) { | 190 | if(evt.keyCode === Keyboard.M ) { |
174 | evt.preventDefault(); | 191 | evt.preventDefault(); |
@@ -197,9 +214,7 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
197 | } | 214 | } |
198 | 215 | ||
199 | if(evt.keyCode === Keyboard.ESCAPE){//ESC key | 216 | if(evt.keyCode === Keyboard.ESCAPE){//ESC key |
200 | //console.log("ESC key pressed"); | ||
201 | if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleEscape(evt); | 217 | if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleEscape(evt); |
202 | //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar"); | ||
203 | } | 218 | } |
204 | 219 | ||
205 | 220 | ||
@@ -214,39 +229,27 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
214 | 229 | ||
215 | // Check if cmd+z/ctrl+z for Undo (Windows/Mac) | 230 | // Check if cmd+z/ctrl+z for Undo (Windows/Mac) |
216 | if ((evt.keyCode == Keyboard.Z) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) { | 231 | if ((evt.keyCode == Keyboard.Z) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) { |
217 | NJevent("executeUndo"); | 232 | document.application.undoManager.undo(); |
218 | //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar"); | ||
219 | return; | ||
220 | } | ||
221 | |||
222 | // Check if cmd+s/ctrl+s for Save (Windows/Mac) | ||
223 | if ((evt.keyCode == Keyboard.S) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) { | ||
224 | try{ | ||
225 | NJevent("executeSave"); | ||
226 | } | ||
227 | catch(e){ | ||
228 | console.warn("Unable to save"); | ||
229 | console.log(e.stack); | ||
230 | } | ||
231 | evt.preventDefault(); | ||
232 | return; | 233 | return; |
233 | } | 234 | } |
234 | 235 | ||
235 | // Check if cmd+shift+z for Redo (Mac) | 236 | // Check if cmd+shift+z for Redo (Mac) |
236 | if ((evt.keyCode == Keyboard.Z) && evt.metaKey && evt.shiftKey) { | 237 | if ((evt.keyCode == Keyboard.Z) && evt.metaKey && evt.shiftKey) { |
237 | NJevent("executeRedo"); | 238 | document.application.undoManager.redo(); |
238 | //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar"); | ||
239 | return; | 239 | return; |
240 | } | 240 | } |
241 | 241 | ||
242 | // Check if ctrl+y for Redo (Windows) | 242 | // Check if ctrl+y for Redo (Windows) |
243 | if ((evt.keyCode == Keyboard.Y) && evt.ctrlKey) { | 243 | if ((evt.keyCode == Keyboard.Y) && evt.ctrlKey) { |
244 | NJevent("executeRedo"); | 244 | document.application.undoManager.redo(); |
245 | //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar"); | ||
246 | return; | 245 | return; |
247 | } | 246 | } |
248 | 247 | ||
249 | 248 | // Check if cmd+s/ctrl+s for Save (Windows/Mac) | |
249 | if ((evt.keyCode == Keyboard.S) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) { | ||
250 | NJevent("executeSave"); | ||
251 | evt.preventDefault(); | ||
252 | } | ||
250 | } | 253 | } |
251 | }, | 254 | }, |
252 | 255 | ||