diff --git a/package.json b/package.json index 91826e9..dfa12b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "miniPaint", - "version": "4.4.2", + "version": "4.5.0", "author": "Vilius L.", "description": "Online graphics editing tool lets create, edit images using HTML5 technologies.", "keywords": [ diff --git a/src/js/config-menu.js b/src/js/config-menu.js index 52f7d56..3513c10 100644 --- a/src/js/config-menu.js +++ b/src/js/config-menu.js @@ -14,7 +14,7 @@ const menuDefinition = [ children: [ { name: 'Open File', - shortcut: 'Drag&Drop', + shortcut: 'O/Drag&Drop', ellipsis: true, target: 'file/open.open_file' }, @@ -121,6 +121,7 @@ const menuDefinition = [ children: [ { name: 'Information', + shortcut: 'I', ellipsis: true, target: 'image/information.information' }, diff --git a/src/js/modules/file/open.js b/src/js/modules/file/open.js index 4dea841..3e91268 100644 --- a/src/js/modules/file/open.js +++ b/src/js/modules/file/open.js @@ -50,6 +50,17 @@ class File_open_class { window.ondragover = function (e) { e.preventDefault(); }; + document.addEventListener('keydown', (event) => { + var code = event.key.toLowerCase(); + if (this.Helper.is_input(event.target)) + return; + + if (code == "o") { + //open + this.open_file(); + event.preventDefault(); + } + }, false); } on_paste(data, width, height) { diff --git a/src/js/modules/help/shortcuts.js b/src/js/modules/help/shortcuts.js index 18d8e69..5861774 100644 --- a/src/js/modules/help/shortcuts.js +++ b/src/js/modules/help/shortcuts.js @@ -13,6 +13,7 @@ class Help_shortcuts_class { params: [ {title: "F9", value: 'Quick Save'}, {title: "F10", value: 'Quick Load'}, + {title: "O", value: 'Open'}, {title: "S", value: 'Save'}, {title: "T", value: 'Trim'}, {title: "F", value: 'Auto Adjust Colors'}, @@ -20,6 +21,7 @@ class Help_shortcuts_class { {title: "L", value: 'Rotate left'}, {title: "N", value: 'New layer'}, {title: "R", value: 'Resize'}, + {title: "I", value: 'Information'}, {title: "Scroll up", value: 'Zoom in'}, {title: "Scroll down", value: 'Zoom out'}, {title: "CTRL + Z", value: 'Undo'}, diff --git a/src/js/modules/image/information.js b/src/js/modules/image/information.js index 0cf2306..ef5840c 100644 --- a/src/js/modules/image/information.js +++ b/src/js/modules/image/information.js @@ -3,12 +3,35 @@ import Dialog_class from './../../libs/popup.js'; import Helper_class from './../../libs/helpers.js'; import Base_layers_class from './../../core/base-layers.js'; +var instance = null; + class Image_information_class { constructor() { + //singleton + if (instance) { + return instance; + } + instance = this; + this.Base_layers = new Base_layers_class(); this.POP = new Dialog_class(); this.Helper = new Helper_class(); + + this.set_events(); + } + + set_events() { + document.addEventListener('keydown', (event) => { + var code = event.key.toLowerCase(); + if (this.Helper.is_input(event.target)) + return; + + if (code == "i") { + this.information(); + event.preventDefault(); + } + }, false); } information() {