Added history to the commander.
This commit is contained in:
parent
747ecc24c6
commit
cce5a57fd0
10
README.md
10
README.md
@ -41,7 +41,7 @@ $ ! ; Clear temporary storage
|
||||
| ! ; Remove all guides
|
||||
```
|
||||
|
||||
##Vector(SVG Path)
|
||||
##Vector(SVG)
|
||||
```
|
||||
+ M10 10 h 80 v 80 h -80 Z ; Draw a square outline
|
||||
+ M10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80 ; Draw a bezier
|
||||
@ -74,13 +74,7 @@ $ ! ; Clear temporary storage
|
||||
= ! ; Zoom 100%
|
||||
```
|
||||
|
||||
##Layers*
|
||||
```
|
||||
# 3 ; Layer 3
|
||||
# ! ; Layer 1
|
||||
```
|
||||
|
||||
#Units*
|
||||
#Units
|
||||
```
|
||||
5 ; value: 5
|
||||
5,7 ; position: 5x 7y
|
||||
|
@ -4,6 +4,7 @@ function Commander(element,element_input)
|
||||
this.element_input = element_input;
|
||||
this.cmd = null;
|
||||
this.storage = [];
|
||||
this.storage_index = 0;
|
||||
|
||||
this.show = function()
|
||||
{
|
||||
@ -17,8 +18,28 @@ function Commander(element,element_input)
|
||||
this.element_input.value = "";
|
||||
}
|
||||
|
||||
this.clear = function()
|
||||
{
|
||||
this.element_input.value = "";
|
||||
}
|
||||
|
||||
this.next_cmd = function()
|
||||
{
|
||||
this.storage_index += this.storage_index < this.storage.length ? 1 : 0;
|
||||
this.element_input.value = this.storage[this.storage_index] ? this.storage[this.storage_index] : "";
|
||||
}
|
||||
|
||||
this.prev_cmd = function()
|
||||
{
|
||||
this.storage_index -= this.storage_index < 1 ? 0 : 1;
|
||||
this.element_input.value = this.storage[this.storage_index];
|
||||
}
|
||||
|
||||
this.active = function(content)
|
||||
{
|
||||
this.storage.push(content.join(" "));
|
||||
this.storage_index = this.storage.length;
|
||||
|
||||
var key = content[0];
|
||||
content.shift();
|
||||
var cmd = new Command(content);
|
||||
@ -58,7 +79,6 @@ function Commander(element,element_input)
|
||||
ronin.vector.active(cmd);
|
||||
break;
|
||||
}
|
||||
this.storage.push(content);
|
||||
this.hide();
|
||||
}
|
||||
|
||||
|
@ -85,10 +85,12 @@ function Keyboard()
|
||||
|
||||
this.key_arrow_up = function()
|
||||
{
|
||||
commander.prev_cmd();
|
||||
}
|
||||
|
||||
this.key_arrow_down = function()
|
||||
{
|
||||
commander.next_cmd();
|
||||
}
|
||||
|
||||
this.key_arrow_left = function()
|
||||
|
@ -13,7 +13,5 @@ function Hint(element)
|
||||
else{
|
||||
this.element.style.display = "none";
|
||||
}
|
||||
|
||||
console.log(ronin.module);
|
||||
}
|
||||
}
|
@ -10,18 +10,16 @@ function Vector()
|
||||
|
||||
this.active = function(cmd)
|
||||
{
|
||||
var path = new Path2D(cmd.content.join(" "));
|
||||
|
||||
console.log(ronin.size);
|
||||
|
||||
ronin.canvas.context().lineCap="round";
|
||||
ronin.canvas.context().lineWidth = ronin.brush.size;
|
||||
ronin.canvas.context().strokeStyle = ronin.brush.color.rgba();
|
||||
ronin.canvas.context().stroke(path);
|
||||
ronin.canvas.context().stroke(Path2D(cmd.content.join(" ")));
|
||||
}
|
||||
|
||||
this.hint = function(cmd)
|
||||
{
|
||||
return "Vector: "
|
||||
}
|
||||
|
||||
// M100,100 h200 a20,20 0 0 1 20,20 v200 a20,20 0 0 1 -20,20 h-200 a20,20 0 0 1 -20,-20 v-200 a20,20 0 0 1 20,-20 z
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user