Optimize relativePositionOffset() to avoid doing unnecessary work