Fix directionspanel popup positioning

Better management of the space available to show the popup