changed depthSort to drawToCanvas