Merge pull request #2 from cblgh/master
new command ~, toggles commander to always show. also patch mousedown…
This commit is contained in:
commit
e06cdf864a
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*.swp
|
||||||
|
*.swo
|
@ -5,6 +5,7 @@ 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()
|
||||||
{
|
{
|
||||||
@ -12,9 +13,15 @@ function Commander(element,element_input)
|
|||||||
this.element_input.focus();
|
this.element_input.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.always = function() {
|
||||||
|
this.always_show = !this.always_show;
|
||||||
|
}
|
||||||
|
|
||||||
this.hide = function()
|
this.hide = function()
|
||||||
{
|
{
|
||||||
|
if (!this.always_show) {
|
||||||
this.element.setAttribute('class','hidden');
|
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;
|
||||||
|
@ -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