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.
Doesn't look like `right_overflow` or `left_overflow` are defined anywhere.