Continent Map – Iterate!

How wrong could I be?

The simplest way to do this is get hold of a bitmap with the regions we want coloured in with just one plain colour. When you click the screen; check the value at that point in the bitmap; and use that value as a key into your list of countries.

Uhh, no; maybe in the 90s. Nowadays in a modern browser; the easiest way is to use an SVG image, with the D3 library. Then we can use jquery style CSS selectors to add click handlers to relevant paths; and on a click event modify its attributes to change the fill colour. D3 also gives us panning and zooming functionality.

Anyway i’ve updated my little project – it’s no longer canvas; I just use an SVG image and the render loop has gone.

There is a small problem – it doesn’t work on my iPad. Debugging will have to wait for another day i’m afraid; perhaps after i’ve added a few more fun bits to it.

One thought on “Continent Map – Iterate!”

Leave a Reply

Your email address will not be published. Required fields are marked *