Drawing handles

This commit is contained in:
Devine Lu Linvega 2018-02-06 14:23:25 +13:00
parent d3b7b113b1
commit 127d36d821
3 changed files with 11 additions and 3 deletions

View File

@ -135,7 +135,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
this.controller.add("default","Edit","Move Down",() => { dotgrid.mod_move(new Pos(0,15)); },"Down");
this.controller.add("default","Edit","Move Left",() => { dotgrid.mod_move(new Pos(-15,0)); },"Left");
this.controller.add("default","Edit","Move Right",() => { dotgrid.mod_move(new Pos(15,0)); },"Right");
this.controller.add("default","Edit","Deselect",() => { dotgrid.reset(); },"Esc");
this.controller.add("default","Edit","Deselect",() => { dotgrid.tool.clear(); },"Esc");
this.controller.add("default","Stroke","Line",() => { dotgrid.tool.cast("line"); },"A");
this.controller.add("default","Stroke","Arc",() => { dotgrid.draw_arc("0,1"); },"S");

View File

@ -72,6 +72,14 @@ function Guide()
this.draw_vertex(dotgrid.tool.verteces[id]);
}
for(segment_id in dotgrid.tool.layer()){
var segment = dotgrid.tool.layer()[segment_id];
for(vertex_id in segment.verteces){
var vertex = segment.verteces[vertex_id];
this.draw_handle(vertex);
}
}
// Translations
if(dotgrid.translation){
this.draw_translation();
@ -99,7 +107,7 @@ function Guide()
ctx.closePath();
}
this.draw_handle = function(pos,radius)
this.draw_handle = function(pos,radius = 5)
{
var ctx = this.widgets.getContext('2d');
@ -108,7 +116,6 @@ function Guide()
ctx.fillStyle = dotgrid.theme.active.f_high;
ctx.fill();
ctx.closePath();
ctx.beginPath();
ctx.arc((pos.x * 2)+20, (pos.y * 2)+20, radius, 0, 2 * Math.PI, false);
ctx.fillStyle = dotgrid.theme.active.f_high;

View File

@ -94,5 +94,6 @@ function Tool()
this.clear = function()
{
this.verteces = [];
dotgrid.draw();
}
}