aboutsummaryrefslogtreecommitdiff
path: root/js/mediators/keyboard-mediator.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/mediators/keyboard-mediator.js')
-rwxr-xr-xjs/mediators/keyboard-mediator.js33
1 files changed, 4 insertions, 29 deletions
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js
index 029c0916..e2e8e937 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") {
@@ -251,7 +252,7 @@ exports.KeyboardMediator = Montage.create(Component, {
251 handleKeyup: { 252 handleKeyup: {
252 value: function(evt) { 253 value: function(evt) {
253 //keyboard controls for html design view 254 //keyboard controls for html design view
254 if((!!this.application.ninja.documentController.activeDocument) && (this.application.ninja.documentController.activeDocument.currentView === "design")){ 255 if((!!this.application.ninja.currentDocument) && (this.application.ninja.currentDocument.currentView === "design")) {
255 if(document.activeElement.nodeName !== "BODY") { 256 if(document.activeElement.nodeName !== "BODY") {
256 // Don't do anything if an input or other control is focused 257 // Don't do anything if an input or other control is focused
257 return; 258 return;
@@ -260,31 +261,5 @@ exports.KeyboardMediator = Montage.create(Component, {
260 if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleKeyUp(evt); 261 if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleKeyUp(evt);
261 } 262 }
262 } 263 }
263 },
264
265 _handleKeydown: {
266 value: function(evt) {
267
268 // Check if cmd-shift-+/ctrl-shift-+ for toggling snapping
269 if(evt.shiftKey && (evt.ctrlKey || evt.metaKey) && (evt.keyCode === 187))
270 {
271 MainMenuModule.MenuActionManager.toggleSnapping("snap", !DocumentManagerModule.DocumentManager.activeDocument.snapping);
272 evt.preventDefault();
273 return;
274 }
275
276 if(evt.keyCode === Keyboard.PLUS && (evt.metaKey||evt.ctrlKey)) {
277 evt.preventDefault();
278 this._toolsList.action("zoomIn", evt);
279 return;
280 }
281
282 if(evt.keyCode === Keyboard.MINUS && (evt.metaKey || evt.ctrlKey)) {
283 evt.preventDefault();
284 this._toolsList.action("zoomOut", evt);
285 return;
286 }
287
288 }
289 } 264 }
290}); 265});