code-dot-org/code-dot-org — pull request #218 by Bjvanminnen (2014-10-20 18:04:29+00:00)
Title: use svg instead of canvas

Convert calc app to use svg instead of canvas. Didn't end up being too hard, and I think this def puts us in a better place.

Feel free to skim as much/little as you like.

One of the semi-interesting pieces is the hack to deal with spaces. getComputedTextLength (and similar functions to it like getBBox) seem to ignore trailing spaces, so setting the text to " + " gives the same width as "+". I deal with this by replacing the space with _, calculating the width, then putting it back to spaces. Let me know if you know of a better way.