diff --git a/scripts/dotgrid.js b/scripts/dotgrid.js index 565c93a..1884f85 100644 --- a/scripts/dotgrid.js +++ b/scripts/dotgrid.js @@ -146,6 +146,29 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca reset(); } + this.draw_dot = function() + { + var s = document.createElementNS("http://www.w3.org/2000/svg", "circle"); + s.setAttribute("cx",-from[0]); + s.setAttribute("cy",from[1]); + s.setAttribute("r","2"); + s.setAttribute("fill","black"); + vector_element.appendChild(s); + + reset(); + } + + this.draw_circle = function() + { + var s = document.createElementNS("http://www.w3.org/2000/svg", "circle"); + s.setAttribute("cx",-from[0]); + s.setAttribute("cy",from[1]); + s.setAttribute("r",(from[0] - to[0])); + vector_element.appendChild(s); + + reset(); + } + this.reset = function() { reset(); diff --git a/scripts/keyboard.js b/scripts/keyboard.js index 115bcb0..e0b5336 100644 --- a/scripts/keyboard.js +++ b/scripts/keyboard.js @@ -11,6 +11,9 @@ function Keyboard() case 81 : dotgrid.reset(); break; case 87 : dotgrid.erase(); break; case 80 : dotgrid.export(); break; + + case 90 : dotgrid.draw_dot(); break; + case 88 : dotgrid.draw_circle(); break; } } } diff --git a/index.html b/template.icon.html similarity index 51% rename from index.html rename to template.icon.html index 3f71a52..a12a77d 100644 --- a/index.html +++ b/template.icon.html @@ -6,7 +6,7 @@ - Dotgrid + Dotgrid(Interface)
@@ -18,6 +18,14 @@
       sS COUNTERWISE
       d  LINE
     
- + diff --git a/template.interface.html b/template.interface.html new file mode 100644 index 0000000..8fa0943 --- /dev/null +++ b/template.interface.html @@ -0,0 +1,36 @@ + + + + + + + + + Dotgrid(Interface) + + +
+      q  CLEAR
+      w  DELETE LAST
+      e  EXPORT
+
+      aA CLOCKWISE
+      sS COUNTERWISE
+      d  LINE
+
+
+      z  DOT
+      x  CIRCLE
+      c  --
+    
+ + +