Drawing a tree on HTML canvas