Ahhh!, Of course!
Now I get it, that is really cool.
I could be wrong but could the zoom possibly cause issues?
because it uses the internal points instead of the supplied points and moves the perpendicular points off the screen?
I think it would be an easy fix if it is an issue, to simply move the zoom to the start of the function before pt1 and pt2 are changed.