If the menu wouldn't be able to appear at the point without going off the current screen, flip the position of the menu.