code-dot-org/blockly — pull request #641 by Bjvanminnen (2014-06-04 23:50:23+00:00)
Title: dirt update simplification

Getting the right dirt image (or flower/hive for bee) was somewhat complicated. We would be adding/removing the element to the DOM when doing resets or when transitioning to/from zero dirt.

This change puts all the logic in one place (updateDirtImage). If the image doesn't yet exist, we'll create it. If it does exist, and the value is 0, we will just hide it instead of removing it. Eventually I think I'd like this code in its own module. Part of why I'm restructuring this is that I might end up needing to have bee behave slightly differently, and want a single point that I can override.