fix placement relative to tall elements

If the element is very tall, prevent the tooltip from being pushed offscreen; make sure that the placement of the arrow cannot escape the range of 0-50% of tooltip height or width