From 1b2af54128985c1b622e13ea740a8402e57527cc Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 4 May 2012 17:11:02 -0700 Subject: Temporarily skipping activeDocument.currentView check so keyboard shortcuts still work. Signed-off-by: Nivesh Rajbhandari --- js/mediators/keyboard-mediator.js | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) (limited to 'js/mediators/keyboard-mediator.js') 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, { value: function(evt) { //keyboard controls for html design view - if((!!this.application.ninja.documentController.activeDocument) && (this.application.ninja.documentController.activeDocument.currentView === "design")){ + // TODO - New template mode doesn't set currentView yet. + if((!!this.application.ninja.currentDocument)){// && (this.application.ninja.currentDocument.model.currentView === "design")){ // Don't do anything if an input or other control is focused if(document.activeElement.nodeName !== "BODY") { @@ -256,7 +257,7 @@ exports.KeyboardMediator = Montage.create(Component, { handleKeyup: { value: function(evt) { //keyboard controls for html design view - if((!!this.application.ninja.documentController.activeDocument) && (this.application.ninja.documentController.activeDocument.currentView === "design")){ + if((!!this.application.ninja.currentDocument)){// && (this.application.ninja.currentDocument.model.currentView === "design")){ if(document.activeElement.nodeName !== "BODY") { // Don't do anything if an input or other control is focused return; @@ -265,31 +266,5 @@ exports.KeyboardMediator = Montage.create(Component, { if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleKeyUp(evt); } } - }, - - _handleKeydown: { - value: function(evt) { - - // Check if cmd-shift-+/ctrl-shift-+ for toggling snapping - if(evt.shiftKey && (evt.ctrlKey || evt.metaKey) && (evt.keyCode === 187)) - { - MainMenuModule.MenuActionManager.toggleSnapping("snap", !DocumentManagerModule.DocumentManager.activeDocument.snapping); - evt.preventDefault(); - return; - } - - if(evt.keyCode === Keyboard.PLUS && (evt.metaKey||evt.ctrlKey)) { - evt.preventDefault(); - this._toolsList.action("zoomIn", evt); - return; - } - - if(evt.keyCode === Keyboard.MINUS && (evt.metaKey || evt.ctrlKey)) { - evt.preventDefault(); - this._toolsList.action("zoomOut", evt); - return; - } - - } } }); -- cgit v1.2.3 From fd54dabad7cbc27a0efb0957155c00d578912909 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 16 May 2012 15:32:36 -0700 Subject: changing @change to propertyChangeListener Signed-off-by: Valerio Virgillito --- js/mediators/keyboard-mediator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/mediators/keyboard-mediator.js') diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 49960f58..243caf5c 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js @@ -67,7 +67,7 @@ exports.KeyboardMediator = Montage.create(Component, { document.addEventListener("keydown", this, false); document.addEventListener("keyup", this, false); - this.addEventListener("change@appModel.livePreview", this.handleLivePreview, false); + this.addPropertyChangeListener("appModel.livePreview", this.handleLivePreview, false); } }, -- cgit v1.2.3