Introduced tempCanvas for temporary line segments rendering.