Better keys
This commit is contained in:
10
index.html
10
index.html
@@ -10,11 +10,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<pre>
|
<pre>
|
||||||
aA <b>ARC CLOCKWISE</b>
|
q <b>CLEAR</b>
|
||||||
sS <b>ARC COUNTERWISE</b>
|
w <b>DELETE LAST</b>
|
||||||
|
e <b>EXPORT</b>
|
||||||
|
|
||||||
|
aA <b>CLOCKWISE</b>
|
||||||
|
sS <b>COUNTERWISE</b>
|
||||||
d <b>LINE</b>
|
d <b>LINE</b>
|
||||||
f <b>CLEAR</b>
|
|
||||||
g <b>DELETE LAST</b>
|
|
||||||
</pre>
|
</pre>
|
||||||
<script type="text/javascript" src="scripts/init.js"></script>
|
<script type="text/javascript" src="scripts/init.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
|||||||
if(from === null || to === null){ return; }
|
if(from === null || to === null){ return; }
|
||||||
|
|
||||||
var s = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
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', "#000000");
|
||||||
s.setAttribute('stroke-width', "3");
|
s.setAttribute('stroke-width', "3");
|
||||||
s.setAttribute('fill', "none");
|
s.setAttribute('fill', "none");
|
||||||
@@ -158,11 +158,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
|||||||
|
|
||||||
this.erase = function()
|
this.erase = function()
|
||||||
{
|
{
|
||||||
erase();
|
if(vector_element.lastChild === null){ return; }
|
||||||
}
|
|
||||||
|
|
||||||
function erase()
|
|
||||||
{
|
|
||||||
vector_element.removeChild(vector_element.lastChild);
|
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);
|
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);
|
y = parseInt(y/this.grid_height) * this.grid_height + (this.grid_height/2);
|
||||||
return [x,y];
|
return [parseInt(x),parseInt(y)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,9 +7,10 @@ function Keyboard()
|
|||||||
case 65 : dotgrid.draw_arc(event.shiftKey ? "1,1" : "0,1"); 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 83 : dotgrid.draw_arc(event.shiftKey ? "1,0" : "0,0"); break;
|
||||||
case 68 : dotgrid.draw_line(); break;
|
case 68 : dotgrid.draw_line(); break;
|
||||||
case 70 : dotgrid.reset(); break;
|
|
||||||
case 71 : dotgrid.erase(); break;
|
case 81 : dotgrid.reset(); break;
|
||||||
case 81 : dotgrid.export(); break;
|
case 87 : dotgrid.erase(); break;
|
||||||
|
case 80 : dotgrid.export(); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user