Fix tooltip positions near the two ends.