Always draw midpoint handles within viewport (like #1840)

This is like #1840, but uses an intersection test to check the visible extent edges.  Also I pass drawMidpoints a slightly trimmed extent so that midpoints don't end up exactly on the edge of the screen, or within the ui bars.