Add inView method to detect if an object is within the viewport