mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
feature : add keyboard shortcuts : initial impl
+ added shortcuts for all tools in ToolController + modified structure of tools in Controller to Array of descriptors to allow to declare shortcuts directly when setting up the tool controller
This commit is contained in:
@ -11,6 +11,13 @@
|
||||
"v" : Events.PASTE
|
||||
}
|
||||
};
|
||||
|
||||
// See ToolController
|
||||
// TODO : Allow for other classes to register new shortcuts
|
||||
var toolKeys = 'pveblrcmzso'.split('');
|
||||
toolKeys.forEach(function (key) {
|
||||
this.keyboardActions_[key] = Events.SELECT_TOOL;
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
||||
@ -34,12 +41,14 @@
|
||||
if(charkey) {
|
||||
if (this.isCtrlKeyPressed_(evt)) {
|
||||
eventToTrigger = this.keyboardActions_.ctrl[charkey];
|
||||
} else {
|
||||
eventToTrigger = this.keyboardActions_[charkey];
|
||||
}
|
||||
}
|
||||
|
||||
if(eventToTrigger) {
|
||||
$.publish(eventToTrigger);
|
||||
evt.preventDefault();
|
||||
if(eventToTrigger) {
|
||||
$.publish(eventToTrigger, charkey);
|
||||
evt.preventDefault();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
(function () {
|
||||
var specialKeys = {};
|
||||
|
||||
var ns = $.namespace('service.keyboard');
|
||||
var ns = $.namespace('pskl.service.keyboard');
|
||||
|
||||
ns.KeycodeTranslator= {
|
||||
toChar : function (keycode) {
|
||||
|
Reference in New Issue
Block a user