code-dot-org/blockly — pull request #501 by Bjvanminnen (2014-04-17 18:48:05+00:00)
Title: [Finishes #69716570] only create each svg pattern once

A lot of this is just refactoring, some of it is new.

The jigsaw backgrounds are done by creating an svg pattern, and then setting their fill to be that pattern. Previously, moving a block to/from the toolbox would result in us creating a new (duplicated) svg pattern. This change has us track created patterns and avoid duplicating.

I decided to move all cache logic to a single place. There are two different cache mechanisms. The first is this new mechanism, where we avoid duplicating patterns. The second is that when adding a new pattern, if the document isn't yet fully loaded, we'll queue up the patternInfo and only create it once the document is loaded

This commit also contains a small change to be able to make it so that on any given puzzle, instead of having smooth edges on the first/last blocks you can have notched blocks (making it easier to have incorrect solves).