code-dot-org/blockly — pull request #668 by cpirich (2014-06-12 20:00:12+00:00)
Title: [finishes #70782706] add arrangeStartBlocks()

Previously, loading shared programs caused problems in studio block alignment.

Unlike other apps, we couldn't just supply config.blockArrangement with reasonable x,y coords for each top-level event block. This is because the number of type of event blocks used could vary dramatically. So instead I've added a new arrangeStartBlocks() just for this app that spreads out all of the event blocks to be vertically spaced by dividing up the total vertical height of the workspace. An improved implementation would try to peek inside each top-level block to determine how many blocks are attached underneath and estimate the amount of vertical space required. Also, we could eventually spill over to a two (or three) column view. But this change seems good enough for now and guarantees that the blocks aren't all dumped on top of each other.

It may be that I can use this for some levels that include startBlocks so I no longer need to careful set the y coordinate for each start block.