Implemented multi-translate

This commit is contained in:
Devine Lu Linvega
2018-03-21 20:35:28 +13:00
parent a486b67876
commit f90b007ace
3 changed files with 32 additions and 2 deletions

View File

@@ -229,6 +229,22 @@ function Tool()
dotgrid.draw();
}
this.translate_multi = function(a,b)
{
var offset = {x:a.x - b.x,y:a.y - b.y}
for(segment_id in this.layer()){
var segment = this.layer()[segment_id];
for(vertex_id in segment.verteces){
var vertex = segment.verteces[vertex_id];
segment.verteces[vertex_id] = {x:vertex.x+offset.x,y:vertex.y-offset.y};
}
}
dotgrid.history.push(this.layers);
this.clear();
dotgrid.draw();
}
// Style
this.style = function()