extracted draw hex logic