new command ~, toggles commander to always show. also patch mousedown + add .gitignore
This commit is contained in:
parent
334f3c980e
commit
7af3b0fb39
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*.swp
|
||||||
|
*.swo
|
@ -5,16 +5,23 @@ function Commander(element,element_input)
|
|||||||
this.cmd = null;
|
this.cmd = null;
|
||||||
this.storage = [];
|
this.storage = [];
|
||||||
this.storage_index = 0;
|
this.storage_index = 0;
|
||||||
|
this.always_show = false;
|
||||||
|
|
||||||
this.show = function()
|
this.show = function()
|
||||||
{
|
{
|
||||||
this.element.setAttribute('class','visible');
|
this.element.setAttribute('class','visible');
|
||||||
this.element_input.focus();
|
this.element_input.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.always = function() {
|
||||||
|
this.always_show = !this.always_show;
|
||||||
|
}
|
||||||
|
|
||||||
this.hide = function()
|
this.hide = function()
|
||||||
{
|
{
|
||||||
this.element.setAttribute('class','hidden');
|
if (!this.always_show) {
|
||||||
|
this.element.setAttribute('class','hidden');
|
||||||
|
}
|
||||||
this.element_input.value = "";
|
this.element_input.value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,6 +52,9 @@ function Commander(element,element_input)
|
|||||||
var cmd = new Command(content);
|
var cmd = new Command(content);
|
||||||
|
|
||||||
switch(key) {
|
switch(key) {
|
||||||
|
case "~":
|
||||||
|
this.always();
|
||||||
|
break;
|
||||||
case "@":
|
case "@":
|
||||||
ronin.canvas.active(cmd);
|
ronin.canvas.active(cmd);
|
||||||
break;
|
break;
|
||||||
@ -127,4 +137,4 @@ function Commander(element,element_input)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,11 @@ var commander = new Commander(document.getElementById("commander"),document.getE
|
|||||||
|
|
||||||
// Interactive
|
// Interactive
|
||||||
|
|
||||||
document.addEventListener('mousemove', function(e) { ronin.brush.draw(e); }, false);
|
document.addEventListener('mousemove', function(e) { ronin.brush.draw(e); ;
|
||||||
document.addEventListener('mousedown', function(e) { if(e.which != 1){ return; } ronin.brush.draw_start(e); }, false);
|
}, false);
|
||||||
document.addEventListener('mouseup', function(e) { ronin.brush.draw_stop(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();
|
var keyboard = new Keyboard();
|
||||||
document.onkeyup = function myFunction(){ keyboard.listen(event); };
|
document.onkeyup = function myFunction(){ keyboard.listen(event); };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user