On the DrawCommandHandler.js align function is simple and efficient, below↓,
But can i align with location object ? not the whole node outer bound.
DrawCommandHandler.prototype.alignLeft = function() {
var diagram = this.diagram;
diagram.startTransaction("aligning left");
var minPosition = Infinity;
diagram.selection.each(function(current) {
if (current instanceof go.Link) return; // skips over go.Link
minPosition = Math.min(current.position.x, minPosition);
});
diagram.selection.each(function(current) {
if (current instanceof go.Link) return; // skips over go.Link
current.move(new go.Point(minPosition, current.position.y));
});
diagram.commitTransaction("aligning left");
};