diff options
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 | }); |