Information and Open shortcuts

This commit is contained in:
viliusle 2020-12-11 20:27:14 +02:00
parent 50c6951b37
commit 2344dee5d2
5 changed files with 39 additions and 2 deletions

View File

@ -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": [

View File

@ -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'
},

View File

@ -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) {

View File

@ -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'},

View File

@ -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() {