Added logic to reposition the callout if it spills outside of the page boundaries.