Fixed issue with arcs
This commit is contained in:
@@ -130,33 +130,10 @@ function Dotgrid(width,height,grid_x,grid_y)
|
||||
reset();
|
||||
}
|
||||
|
||||
this.draw_arc_c = function()
|
||||
{
|
||||
draw_arc_c();
|
||||
}
|
||||
|
||||
draw_arc_c = function()
|
||||
this.draw_arc = function(orientation)
|
||||
{
|
||||
var s = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
||||
s.setAttribute("d","M"+(-from[0])+","+(from[1])+" A15,15 0 0,1 "+(-to[0])+","+(to[1])+"");
|
||||
s.setAttribute('stroke', "#000000");
|
||||
s.setAttribute('stroke-width', "5");
|
||||
s.setAttribute('fill', "none");
|
||||
s.setAttribute('stroke-linecap', "round");
|
||||
vector_element.appendChild(s);
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
this.draw_arc_a = function()
|
||||
{
|
||||
draw_arc_a();
|
||||
}
|
||||
|
||||
function draw_arc_a()
|
||||
{
|
||||
var s = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
||||
s.setAttribute("d","M"+(-from[0])+","+(from[1])+" A15,15 0 1,0 "+(-to[0])+","+(to[1])+"");
|
||||
s.setAttribute("d","M"+(-from[0])+","+(from[1])+" A15,15 0 "+orientation+" "+(-to[0])+","+(to[1])+"");
|
||||
s.setAttribute('stroke', "#000000");
|
||||
s.setAttribute('stroke-width', "5");
|
||||
s.setAttribute('fill', "none");
|
||||
|
||||
@@ -2,11 +2,10 @@ function Keyboard()
|
||||
{
|
||||
this.listen = function(event)
|
||||
{
|
||||
console.log(event.keyCode);
|
||||
|
||||
console.log(event);
|
||||
switch (event.keyCode) {
|
||||
case 65 : dotgrid.draw_arc_a(); break;
|
||||
case 83 : dotgrid.draw_arc_c(); break;
|
||||
case 65 : dotgrid.draw_arc(event.shiftKey ? "1,1" : "0,1"); break;
|
||||
case 83 : dotgrid.draw_arc(event.shiftKey ? "1,0" : "0,0"); break;
|
||||
case 68 : dotgrid.draw_line(); break;
|
||||
case 70 : dotgrid.reset(); break;
|
||||
case 71 : dotgrid.erase(); break;
|
||||
|
||||
Reference in New Issue
Block a user