new command ~, toggles commander to always show. also patch mousedown + add .gitignore

This commit is contained in:
Alexander Cobleigh 2016-11-17 20:37:45 +01:00
parent 334f3c980e
commit 7af3b0fb39
3 changed files with 20 additions and 6 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.swp
*.swo

View File

@ -5,6 +5,7 @@ function Commander(element,element_input)
this.cmd = null;
this.storage = [];
this.storage_index = 0;
this.always_show = false;
this.show = function()
{
@ -12,9 +13,15 @@ function Commander(element,element_input)
this.element_input.focus();
}
this.always = function() {
this.always_show = !this.always_show;
}
this.hide = function()
{
this.element.setAttribute('class','hidden');
if (!this.always_show) {
this.element.setAttribute('class','hidden');
}
this.element_input.value = "";
}
@ -45,6 +52,9 @@ function Commander(element,element_input)
var cmd = new Command(content);
switch(key) {
case "~":
this.always();
break;
case "@":
ronin.canvas.active(cmd);
break;

View File

@ -7,9 +7,11 @@ var commander = new Commander(document.getElementById("commander"),document.getE
// Interactive
document.addEventListener('mousemove', function(e) { ronin.brush.draw(e); }, false);
document.addEventListener('mousedown', function(e) { if(e.which != 1){ return; } ronin.brush.draw_start(e); }, false);
document.addEventListener('mouseup', function(e) { ronin.brush.draw_stop(e); }, false);
document.addEventListener('mousemove', function(e) { ronin.brush.draw(e); ;
}, false);
document.addEventListener('mousedown', function(e) { if(e.which != 1){ return; } ronin.brush.draw_start(e); ronin.brush.draw(e) }, false);
document.addEventListener('mouseup', function(e) { ronin.brush.draw_stop(e); document.getElementById("commander_input").focus();}, false);
var keyboard = new Keyboard();
document.onkeyup = function myFunction(){ keyboard.listen(event); };