diff options
author | Jose Antonio Marquez | 2012-05-07 10:38:04 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-05-07 10:38:04 -0700 |
commit | 5293ede5f3493900df93da33197416d853f8d907 (patch) | |
tree | 3155deaea5616fa09fc96c84567419fec5f288a2 /js/mediators/keyboard-mediator.js | |
parent | 9c0bda09a502472768f6dd5090a882d11be58d23 (diff) | |
parent | 30e837ade2da7cb20caf7c5a69faf0888736bb9a (diff) | |
download | ninja-5293ede5f3493900df93da33197416d853f8d907.tar.gz |
Merge branch 'refs/heads/Ninja-DOM-Architecture' into Document
Diffstat (limited to 'js/mediators/keyboard-mediator.js')
-rwxr-xr-x | js/mediators/keyboard-mediator.js | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index f8934669..49960f58 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js | |||
@@ -87,7 +87,8 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
87 | value: function(evt) { | 87 | value: function(evt) { |
88 | 88 | ||
89 | //keyboard controls for html design view | 89 | //keyboard controls for html design view |
90 | if((!!this.application.ninja.documentController.activeDocument) && (this.application.ninja.documentController.activeDocument.currentView === "design")){ | 90 | // TODO - New template mode doesn't set currentView yet. |
91 | if((!!this.application.ninja.currentDocument)){// && (this.application.ninja.currentDocument.model.currentView === "design")){ | ||
91 | 92 | ||
92 | // Don't do anything if an input or other control is focused | 93 | // Don't do anything if an input or other control is focused |
93 | if(document.activeElement.nodeName !== "BODY") { | 94 | if(document.activeElement.nodeName !== "BODY") { |
@@ -256,7 +257,7 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
256 | handleKeyup: { | 257 | handleKeyup: { |
257 | value: function(evt) { | 258 | value: function(evt) { |
258 | //keyboard controls for html design view | 259 | //keyboard controls for html design view |
259 | if((!!this.application.ninja.documentController.activeDocument) && (this.application.ninja.documentController.activeDocument.currentView === "design")){ | 260 | if((!!this.application.ninja.currentDocument)){// && (this.application.ninja.currentDocument.model.currentView === "design")){ |
260 | if(document.activeElement.nodeName !== "BODY") { | 261 | if(document.activeElement.nodeName !== "BODY") { |
261 | // Don't do anything if an input or other control is focused | 262 | // Don't do anything if an input or other control is focused |
262 | return; | 263 | return; |
@@ -265,31 +266,5 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
265 | if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleKeyUp(evt); | 266 | if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleKeyUp(evt); |
266 | } | 267 | } |
267 | } | 268 | } |
268 | }, | ||
269 | |||
270 | _handleKeydown: { | ||
271 | value: function(evt) { | ||
272 | |||
273 | // Check if cmd-shift-+/ctrl-shift-+ for toggling snapping | ||
274 | if(evt.shiftKey && (evt.ctrlKey || evt.metaKey) && (evt.keyCode === 187)) | ||
275 | { | ||
276 | MainMenuModule.MenuActionManager.toggleSnapping("snap", !DocumentManagerModule.DocumentManager.activeDocument.snapping); | ||
277 | evt.preventDefault(); | ||
278 | return; | ||
279 | } | ||
280 | |||
281 | if(evt.keyCode === Keyboard.PLUS && (evt.metaKey||evt.ctrlKey)) { | ||
282 | evt.preventDefault(); | ||
283 | this._toolsList.action("zoomIn", evt); | ||
284 | return; | ||
285 | } | ||
286 | |||
287 | if(evt.keyCode === Keyboard.MINUS && (evt.metaKey || evt.ctrlKey)) { | ||
288 | evt.preventDefault(); | ||
289 | this._toolsList.action("zoomOut", evt); | ||
290 | return; | ||
291 | } | ||
292 | |||
293 | } | ||
294 | } | 269 | } |
295 | }); | 270 | }); |