Showing posts with label google. Show all posts
Showing posts with label google. Show all posts

2.06.2011

Debugging is hard sometimes

So my last post finished with me asserting, boldly, that there was a minor issues with projecting coordinates that was causing my fractals to come out warped. I went to bed thinking that there'd be no problem. I spent about 6 hours today writing and re-writing projection code because I thought for sure that that was the part of the code that was causing me problems.

I was wrong. It turns out that unlike a <div>, <canvas> tags do not like to have their dimensions set through CSS attributes. Rather, they are sized directly using HTML attributes. It's the difference between
<canvas id="fracMap" style="width:512px; height:512px;"></canvas>
and
<canvas id="fracMap" width="512" height="512"></canvas>
Switching from the first form to the second cleared up my problem. Sadly, this was the very last thing I tried (Obviously. You always find your keys in the last place you look, right?). In the meantime, though, I half-heartedly cleaned up all of the rest of the code. I haven't written this much code in a while, and it feels good. I will never love JavaScript, however. Google has done some pretty awesome things with such an eccentric language. Whenever I move to independent hosting, I'll upload what I have so far.