Fixed issue with close

This commit is contained in:
Devine Lu Linvega
2018-05-11 09:13:01 +12:00
parent 1ac7c46c0e
commit b7e8b8e578
4 changed files with 16 additions and 4 deletions

View File

@@ -49,7 +49,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
this.controller.add("default","Stroke","Arc",() => { dotgrid.tool.cast("arc_c"); },"S"); // 0,1
this.controller.add("default","Stroke","Arc Rev",() => { dotgrid.tool.cast("arc_r")},"D"); // 0,0
this.controller.add("default","Stroke","Bezier",() => { dotgrid.tool.cast("bezier") },"F");
this.controller.add("default","Stroke","Connect",() => { dotgrid.tool.cast("close") },"Z");
this.controller.add("default","Stroke","Close",() => { dotgrid.tool.cast("close") },"Z");
this.controller.add("default","Effect","Linecap",() => { dotgrid.mod_linecap(); },"Q");
this.controller.add("default","Effect","Linejoin",() => { dotgrid.mod_linejoin(); },"W");
@@ -179,6 +179,9 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
console.log("Begin translation"); dotgrid.cursor.translation = {from:pos,to:pos};
if(e.shiftKey){ console.log("Begin translation(multi)"); dotgrid.cursor.multi = true; }
}
dotgrid.guide.refresh();
dotgrid.interface.refresh();
}
this.mouse_move = function(e)
@@ -192,6 +195,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
if(dotgrid.cursor.translation && (Math.abs(dotgrid.cursor.translation.from.x) != Math.abs(pos.x) || Math.abs(dotgrid.cursor.translation.from.y) != Math.abs(pos.y))){ dotgrid.cursor.translation.to = pos; }
dotgrid.guide.refresh();
dotgrid.interface.refresh();
e.preventDefault();
}
@@ -222,7 +226,10 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
this.tool.add_vertex({x:pos.x * -1,y:pos.y});
dotgrid.cursor.translation = null;
dotgrid.interface.refresh();
dotgrid.guide.refresh();
e.preventDefault();
}
@@ -301,7 +308,8 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
this.grid_height = this.tool.settings.size.height/this.grid_y;
dotgrid.guide.resize(size);
this.interface.update();
this.interface.refresh();
dotgrid.guide.refresh();
}

View File

@@ -54,6 +54,10 @@ function Generator(layer)
console.warn(`unknown type:${type}`)
}
}
if(segment.type == "close"){
html += "Z "
}
return html
}

View File

@@ -39,7 +39,7 @@ function Interface()
this.menu_el.innerHTML = html
}
this.update = function()
this.refresh = function()
{
document.getElementById("line").className.baseVal = !dotgrid.tool.can_cast("line") ? "icon inactive" : "icon";
document.getElementById("arc_c").className.baseVal = !dotgrid.tool.can_cast("arc_c") ? "icon inactive" : "icon";

View File

@@ -138,7 +138,7 @@ function Tool()
else{
this.layer().push({type:type,vertices:this.vertices.slice()})
}
this.clear();
dotgrid.guide.refresh();
dotgrid.history.push(this.layers);