new command ~, toggles commander to always show. also patch mousedown + add .gitignore
This commit is contained in:
		
							
								
								
									
										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.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() | ||||
|   { | ||||
|     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; | ||||
|   | ||||
| @@ -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); }; | ||||
		Reference in New Issue
	
	Block a user