JS and Canvas to draw a tree