From 2557f463c1cfe2d0dd8ea187c184755bd141dab4 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 22 Mar 2012 10:38:44 -0700 Subject: IKNINJA-1302 : For File>New and File>SaveAll dialogs, 'ESC' key now triggers Cancel button and 'Enter' key now triggers OK button. For File picker, the 'ESC' now triggers the Cancel button. Signed-off-by: Ananya Sen Conflicts: js/io/ui/new-file-dialog/new-file-workflow-controller.js Signed-off-by: Ananya Sen --- js/mediators/keyboard-mediator.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'js/mediators/keyboard-mediator.js') diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 65dd34cd..63dcfa88 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js @@ -246,6 +246,35 @@ exports.KeyboardMediator = Montage.create(Component, { return; } + // check for ENTER key + if((evt.keyCode == Keyboard.ENTER) && !(evt.ctrlKey || evt.metaKey)) { + //new file + if((this.application.ninja.newFileController.newFileOptionsNav !== null) + && !this.application.ninja.newFileController.newFileOptionsNav.okButton.hasAttribute("disabled")){ + + this.application.ninja.newFileController.newFileOptionsNav.handleOkButtonAction(); + } + //save as + if((this.application.ninja.newFileController.saveAsDialog !== null) + && !this.application.ninja.newFileController.saveAsDialog.okButton.hasAttribute("disabled")){ + + this.application.ninja.newFileController.saveAsDialog.handleOkButtonAction(); + } + return; + } + //ESC key + if(evt.keyCode === Keyboard.ESCAPE){ + if(this.application.ninja.filePickerController.pickerNavChoices !== null){ + this.application.ninja.filePickerController.pickerNavChoices.handleCancelButtonAction(); + } + if(this.application.ninja.newFileController.newFileOptionsNav !== null){ + this.application.ninja.newFileController.newFileOptionsNav.handleCancelButtonAction(); + } + if(this.application.ninja.newFileController.saveAsDialog !== null){ + this.application.ninja.newFileController.saveAsDialog.handleCancelButtonAction(); + } + return; + } } }, -- cgit v1.2.3 From 80ceeffeb3dd3227008714b8b56383f9556ff409 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 22 Mar 2012 14:49:17 -0700 Subject: KNINJA-1302 : refactored fixed as per request Signed-off-by: Ananya Sen --- js/mediators/keyboard-mediator.js | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'js/mediators/keyboard-mediator.js') diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 63dcfa88..fc0d0f6a 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js @@ -245,37 +245,6 @@ exports.KeyboardMediator = Montage.create(Component, { //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar"); return; } - - // check for ENTER key - if((evt.keyCode == Keyboard.ENTER) && !(evt.ctrlKey || evt.metaKey)) { - //new file - if((this.application.ninja.newFileController.newFileOptionsNav !== null) - && !this.application.ninja.newFileController.newFileOptionsNav.okButton.hasAttribute("disabled")){ - - this.application.ninja.newFileController.newFileOptionsNav.handleOkButtonAction(); - } - //save as - if((this.application.ninja.newFileController.saveAsDialog !== null) - && !this.application.ninja.newFileController.saveAsDialog.okButton.hasAttribute("disabled")){ - - this.application.ninja.newFileController.saveAsDialog.handleOkButtonAction(); - } - return; - } - //ESC key - if(evt.keyCode === Keyboard.ESCAPE){ - if(this.application.ninja.filePickerController.pickerNavChoices !== null){ - this.application.ninja.filePickerController.pickerNavChoices.handleCancelButtonAction(); - } - if(this.application.ninja.newFileController.newFileOptionsNav !== null){ - this.application.ninja.newFileController.newFileOptionsNav.handleCancelButtonAction(); - } - if(this.application.ninja.newFileController.saveAsDialog !== null){ - this.application.ninja.newFileController.saveAsDialog.handleCancelButtonAction(); - } - return; - } - } }, -- cgit v1.2.3 From a11ef2eed7049835c8bdfa50a2b893632c46eaa0 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 4 Apr 2012 11:11:58 -0700 Subject: Squashed commit of Preparing for the montage undo-manager: Architecture changes Reworked the add and remove elements into 1 function which can take 1 or more elements. Removed the _element from the selection array Many other changes related to those 2 changes Undo/Redo shortcuts are now using montage undo/redo manager. Signed-off-by: Valerio Virgillito --- js/mediators/keyboard-mediator.js | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) (limited to 'js/mediators/keyboard-mediator.js') diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index fc0d0f6a..82596693 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js @@ -99,12 +99,11 @@ exports.KeyboardMediator = Montage.create(Component, { evt.preventDefault(); } - // Check DELETE OR BACKSPACE + // DELETE or BACKSPACE event handler - Removes the current selected elements from the DOM if((evt.keyCode == Keyboard.BACKSPACE) || (evt.keyCode == Keyboard.DELETE)) { evt.stopImmediatePropagation(); evt.preventDefault(); - NJevent("deleting"); - return; + return this.application.ninja.elementMediator.removeElements(document.application.ninja.selectedElements); } @@ -197,9 +196,7 @@ exports.KeyboardMediator = Montage.create(Component, { } if(evt.keyCode === Keyboard.ESCAPE){//ESC key - //console.log("ESC key pressed"); if(this.application.ninja.toolsData) this.application.ninja.toolsData.selectedToolInstance.HandleEscape(evt); - //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar"); } @@ -214,37 +211,27 @@ exports.KeyboardMediator = Montage.create(Component, { // Check if cmd+z/ctrl+z for Undo (Windows/Mac) if ((evt.keyCode == Keyboard.Z) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) { - NJevent("executeUndo"); - //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar"); - return; - } - - // Check if cmd+s/ctrl+s for Save (Windows/Mac) - if ((evt.keyCode == Keyboard.S) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) { - try{ - NJevent("executeSave"); - } - catch(e){ - console.warn("Unable to save"); - console.log(e.stack); - } - evt.preventDefault(); + document.application.undoManager.undo(); return; } // Check if cmd+shift+z for Redo (Mac) if ((evt.keyCode == Keyboard.Z) && evt.metaKey && evt.shiftKey) { - NJevent("executeRedo"); - //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar"); + document.application.undoManager.redo(); return; } - // Check if ctrl+y for Redo (Windows) + // Check if ctrl+y for Redo (Windows) if ((evt.keyCode == Keyboard.Y) && evt.ctrlKey) { - NJevent("executeRedo"); - //menuViewManagerModule.MenuViewManager.closeMenu("mainMenuBar"); + document.application.undoManager.redo(); return; } + + // Check if cmd+s/ctrl+s for Save (Windows/Mac) + if ((evt.keyCode == Keyboard.S) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) { + NJevent("executeSave"); + evt.preventDefault(); + } } }, -- cgit v1.2.3 From fe2ea22983e29b1e99dabe883e773c4949d3d6e2 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 13 Apr 2012 12:23:00 -0700 Subject: IKNinja-1022 - PaintBucket tooltip is incorrect. Also added kb shortcuts for PaintBucket, InkBottle and Eyedropper tools. Signed-off-by: Nivesh Rajbhandari --- js/mediators/keyboard-mediator.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'js/mediators/keyboard-mediator.js') diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 82596693..79967799 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js @@ -168,6 +168,24 @@ exports.KeyboardMediator = Montage.create(Component, { return; } + // Paint Bucket Tool and Ink Bottle tools share keyboard shortcut K + if(evt.keyCode === Keyboard.K ) { + evt.preventDefault(); + if(this.application.ninja.toolsData.selectedTool.id === "FillTool") { + this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[11]}); + } else { + this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[10]}); + } + return; + } + + // Shortcut for Eyedropper Tool is I + if(evt.keyCode === Keyboard.I ) { + evt.preventDefault(); + this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[12]}); + return; + } + // Rotate Stage Tool is M if(evt.keyCode === Keyboard.M ) { evt.preventDefault(); -- cgit v1.2.3