Bound an adjusted popup on the left and top margin.

This math is hairier than I'd like.