Correct tooltip alignment based on nub position

Currently when a tooltip is configured to hang off the bottom with the nub on the right
(`tipLocation:bottom;nubLocation:top-right`), the nub is no longer pointing at the target.

This patch moves the tooltip so that the right side of the tooltip lines up with the right side of the target element.

The same code is repeated for both the bottom and top blocks, so it should probably be factored out, but I wasn't sure where to put it, but if you let me know what to name a helper method, I can change this.