Fixes screen overflow issues with tooltips

Where there is insufficient space for a tooltip, this either changes the position or moves the tooltip and the nub so that it fits on screen.
Whoops, fixed it.