diff --git a/README.md b/README.md index 7938e73..6a116ba 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,12 @@ $ ! ; Clear temporary storage | ! ; Remove all guides ``` +##Vector(SVG Path) +``` ++ 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 +``` + ##Stroke* ``` - 0,0 0,10 10,10 10,0 0,0 ; Draw a square diff --git a/scripts/commander.js b/scripts/commander.js index 69e0ea2..2e235c2 100644 --- a/scripts/commander.js +++ b/scripts/commander.js @@ -3,6 +3,7 @@ function Commander(element,element_input) this.element = element; this.element_input = element_input; this.cmd = null; + this.storage = []; this.show = function() { @@ -57,7 +58,7 @@ function Commander(element,element_input) ronin.vector.active(cmd); break; } - + this.storage.push(content); this.hide(); } diff --git a/scripts/ronin.vector.js b/scripts/ronin.vector.js index 5a07fb9..3172ae3 100644 --- a/scripts/ronin.vector.js +++ b/scripts/ronin.vector.js @@ -10,7 +10,13 @@ function Vector() this.active = function(cmd) { - var path = new Path2D('M 100,100 h 50 v 50 h 50'); + 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); } @@ -18,4 +24,7 @@ function Vector() { return "Vector: " } + + // Demo: + // > 5 #ff0000;+ M10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80 } \ No newline at end of file