Better keys

This commit is contained in:
Devine Lu Linvega 2016-12-31 13:55:35 -07:00
parent 9817caf4f1
commit 3fb1b2b469
3 changed files with 13 additions and 14 deletions

View File

@ -10,11 +10,13 @@
</head>
<body>
<pre>
aA <b>ARC CLOCKWISE</b>
sS <b>ARC COUNTERWISE</b>
q <b>CLEAR</b>
w <b>DELETE LAST</b>
e <b>EXPORT</b>
aA <b>CLOCKWISE</b>
sS <b>COUNTERWISE</b>
d <b>LINE</b>
f <b>CLEAR</b>
g <b>DELETE LAST</b>
</pre>
<script type="text/javascript" src="scripts/init.js"></script>
</body>

View File

@ -131,7 +131,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
if(from === null || to === null){ return; }
var s = document.createElementNS("http://www.w3.org/2000/svg", "path");
s.setAttribute("d","M"+(-from[0])+","+(from[1])+" A"+this.grid_width+","+this.grid_height+" 0 "+orientation+" "+(-to[0])+","+(to[1])+"");
s.setAttribute("d","M"+(-from[0])+","+(from[1])+" A"+(to[0] - from[0])+","+(to[1] - from[1])+" 0 "+orientation+" "+(-to[0])+","+(to[1])+"");
s.setAttribute('stroke', "#000000");
s.setAttribute('stroke-width', "3");
s.setAttribute('fill', "none");
@ -158,11 +158,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
this.erase = function()
{
erase();
}
function erase()
{
if(vector_element.lastChild === null){ return; }
vector_element.removeChild(vector_element.lastChild);
}
@ -184,6 +180,6 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
{
x = parseInt(x/this.grid_width) * this.grid_width - (this.grid_width/2);
y = parseInt(y/this.grid_height) * this.grid_height + (this.grid_height/2);
return [x,y];
return [parseInt(x),parseInt(y)];
}
}

View File

@ -7,9 +7,10 @@ function Keyboard()
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;
case 81 : dotgrid.export(); break;
case 81 : dotgrid.reset(); break;
case 87 : dotgrid.erase(); break;
case 80 : dotgrid.export(); break;
}
}
}