Hello Antonio,
There are a couple of built-in functions provided by Blockly that may help you out.
1) The
workspace.zoomCenter function centers the view of the blocks (without moving the blocks themselves).
2) The
workspace.zoomToFit function puts all of the blocks within view (again without moving the blocks themselves).
3) The
workspace.cleanup function, which moves the blocks so that they are all in a column.
If you want to create your own function that rearranges the blocks (similar to workspace.cleanup) I recommend checking out the
source code for cleanup. This will show you which functions you might want to use to rearrange your blocks =)
I hope that helps! If you have any further questions please reply!
--Beka