This method only calculates the relative position to a specific element that is guaranteed to be a parent of the target. It also considers the scrolling status of `rootElement` and transform the point to the viewport coordinate.