Migrated the remaining shortcuts

This commit is contained in:
Devine Lu Linvega 2018-01-20 15:00:08 +13:00
parent 801cb3e9af
commit dc1b8738ac
3 changed files with 16 additions and 34 deletions

View File

@ -118,6 +118,20 @@ function Commander()
ronin.commander.update();
}
this.activate = function()
{
ronin.cursor.update();
ronin.commander.autocomplete();
ronin.commander.show();
setTimeout(()=>{ronin.commander.focus},100)
}
this.deactivate = function()
{
this.blur();
this.hide();
}
this.show = function()
{
this.el.className = "visible";

View File

@ -4,16 +4,6 @@ function Keyboard()
this.key_up = function(e)
{
if(e.key == "tab" || e.keyCode == 9){
e.preventDefault();
ronin.cursor.update();
ronin.commander.autocomplete();
ronin.commander.show();
setTimeout(()=>{ronin.commander.focus},100)
return;
}
ronin.keyboard.is_down[e.key] = false;
ronin.hint.update(e);
}
@ -21,34 +11,10 @@ function Keyboard()
{
ronin.keyboard.is_down[e.key] = true;
if(e.key == "/"){
e.preventDefault();
ronin.commander.inject("~")
return;
}
if(e.key == "Enter"){
e.preventDefault();
ronin.commander.validate();
}
if(e.key == "Escape"){
e.preventDefault();
ronin.commander.input_el.blur();
ronin.commander.input_el.value = "";
ronin.guide.update();
ronin.guide.clear();
ronin.guide.inspect = false;
if(!ronin.commander.is_focused()){
ronin.commander.hide();
}
}
// Macros
if(e.key == "f" && (e.ctrlKey || e.metaKey)){
e.preventDefault();
ronin.commander.inject(`frame fill:${ronin.cursor.color}`)
}
if(ronin.commander.is_focused()){
ronin.hint.update(e);

View File

@ -85,6 +85,8 @@ function Ronin()
this.controller.add("default","Brush","Dec Size",() => { ronin.brush.mod_size(-1); },"[");
this.controller.add("default","Brush","Toggle Color",() => { ronin.cursor.swap_colors(); },"x");
this.controller.add("default","Commander","Show",() => { ronin.commander.activate(); },"`");
this.controller.add("default","Commander","Hide",() => { ronin.commander.deactivate(); },"Escape");
this.controller.add("default","Commander","Fill With $",() => { ronin.commander.inject("fill:$"); },"CmdOrCtrl+F");
this.controller.add("default","View","Zoom Reset",() => { ronin.frame.methods.zoom.run(1); },"1");