Added shapes
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user