diff options
author | Pushkar Joshi | 2012-05-31 17:16:21 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-05-31 17:16:21 -0700 |
commit | 8915a7109d918a2e69b0999ebaa2deb84811fef8 (patch) | |
tree | 19a8af74c58c9ea261f0842f36efdab959be3256 /js/mediators/keyboard-mediator.js | |
parent | eea0a556e44c2b60d3aaf6e46d2432d3e6303812 (diff) | |
parent | 06b609df1ff7833592faddbd8d7abb5b9f15a74d (diff) | |
download | ninja-8915a7109d918a2e69b0999ebaa2deb84811fef8.tar.gz |
Merge branch 'pentool' into brushtool
Diffstat (limited to 'js/mediators/keyboard-mediator.js')
-rwxr-xr-x | js/mediators/keyboard-mediator.js | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 5d5537d5..4fd4bd4c 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js | |||
@@ -67,7 +67,7 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
67 | document.addEventListener("keydown", this, false); | 67 | document.addEventListener("keydown", this, false); |
68 | document.addEventListener("keyup", this, false); | 68 | document.addEventListener("keyup", this, false); |
69 | 69 | ||
70 | this.addEventListener("change@appModel.livePreview", this.handleLivePreview, false); | 70 | this.addPropertyChangeListener("appModel.livePreview", this.handleLivePreview, false); |
71 | } | 71 | } |
72 | }, | 72 | }, |
73 | 73 | ||
@@ -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.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") { |
@@ -258,7 +259,7 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
258 | handleKeyup: { | 259 | handleKeyup: { |
259 | value: function(evt) { | 260 | value: function(evt) { |
260 | //keyboard controls for html design view | 261 | //keyboard controls for html design view |
261 | if((!!this.application.ninja.documentController.activeDocument) && (this.application.ninja.documentController.activeDocument.currentView === "design")){ | 262 | if((!!this.application.ninja.currentDocument) && (this.application.ninja.currentDocument.currentView === "design")) { |
262 | if(document.activeElement.nodeName !== "BODY") { | 263 | if(document.activeElement.nodeName !== "BODY") { |
263 | // Don't do anything if an input or other control is focused | 264 | // Don't do anything if an input or other control is focused |
264 | return; | 265 | return; |
@@ -267,31 +268,5 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
267 | if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleKeyUp(evt); | 268 | if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleKeyUp(evt); |
268 | } | 269 | } |
269 | } | 270 | } |
270 | }, | ||
271 | |||
272 | _handleKeydown: { | ||
273 | value: function(evt) { | ||
274 | |||
275 | // Check if cmd-shift-+/ctrl-shift-+ for toggling snapping | ||
276 | if(evt.shiftKey && (evt.ctrlKey || evt.metaKey) && (evt.keyCode === 187)) | ||
277 | { | ||
278 | MainMenuModule.MenuActionManager.toggleSnapping("snap", !DocumentManagerModule.DocumentManager.activeDocument.snapping); | ||
279 | evt.preventDefault(); | ||
280 | return; | ||
281 | } | ||
282 | |||
283 | if(evt.keyCode === Keyboard.PLUS && (evt.metaKey||evt.ctrlKey)) { | ||
284 | evt.preventDefault(); | ||
285 | this._toolsList.action("zoomIn", evt); | ||
286 | return; | ||
287 | } | ||
288 | |||
289 | if(evt.keyCode === Keyboard.MINUS && (evt.metaKey || evt.ctrlKey)) { | ||
290 | evt.preventDefault(); | ||
291 | this._toolsList.action("zoomOut", evt); | ||
292 | return; | ||
293 | } | ||
294 | |||
295 | } | ||
296 | } | 271 | } |
297 | }); | 272 | }); |