2017-11-05 13:59:11 +14:00
|
|
|
function Path_Line(from,to,end = null)
|
|
|
|
|
{
|
2017-11-06 08:38:14 +13:00
|
|
|
this.name = "line";
|
|
|
|
|
|
2017-11-05 13:59:11 +14:00
|
|
|
this.from = from;
|
|
|
|
|
this.to = to;
|
|
|
|
|
this.end = end;
|
|
|
|
|
|
|
|
|
|
this.to_segment = function(prev)
|
|
|
|
|
{
|
|
|
|
|
var html = ""
|
|
|
|
|
|
2017-11-06 08:15:31 +13:00
|
|
|
if(!prev || (!prev.to && !prev.end)){
|
2017-11-12 13:47:34 -08:00
|
|
|
html += "M"+this.from.scale(dotgrid.scale)+" ";
|
2017-11-05 13:59:11 +14:00
|
|
|
}
|
|
|
|
|
else if(prev){
|
2017-11-05 17:33:04 +13:00
|
|
|
if(prev.end){
|
2017-11-12 13:47:34 -08:00
|
|
|
if(!prev.end.is_equal(this.from.scale(dotgrid.scale))){
|
|
|
|
|
html += "M"+this.from.scale(dotgrid.scale)+" ";
|
2017-11-05 17:33:04 +13:00
|
|
|
}
|
2017-11-05 13:59:11 +14:00
|
|
|
}
|
2017-11-05 17:33:04 +13:00
|
|
|
else if(prev.to){
|
2017-11-12 13:47:34 -08:00
|
|
|
if(!prev.to.is_equal(this.from.scale(dotgrid.scale))){
|
|
|
|
|
html += "M"+this.from.scale(dotgrid.scale)+" ";
|
2017-11-05 17:33:04 +13:00
|
|
|
}
|
2017-11-05 13:59:11 +14:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-12 13:47:34 -08:00
|
|
|
html += "L"+this.to.scale(dotgrid.scale)+" "
|
2017-11-05 13:59:11 +14:00
|
|
|
|
|
|
|
|
if(this.end){
|
2017-11-12 13:47:34 -08:00
|
|
|
html += "L"+this.end.scale(dotgrid.scale)+" "
|
2017-11-05 13:59:11 +14:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return html
|
|
|
|
|
}
|
|
|
|
|
}
|