improve tooltip positioning near the edge of the screen