Creates and provides a reactive viewport rectangle for a viewer host element.
This function is meant to be called once near the root of a viewer subtree,
typically from the main viewer component that owns the container element.
It measures the target element with getBoundingClientRect(), keeps the
result synchronized as layout changes, and exposes that state to descendants
through Vue's dependency injection.
Synchronization happens in three situations:
When the target element starts existing.
When the target element is resized.
When the browser window is resized.
Descendants can then consume the provided state with useViewerRect
without prop drilling through intermediate components.
Parameters
targetRef: Ref<HTMLElement|undefined>
Ref pointing at the viewer host element to observe.
Creates and provides a reactive viewport rectangle for a viewer host element.
This function is meant to be called once near the root of a viewer subtree, typically from the main viewer component that owns the container element. It measures the target element with
getBoundingClientRect(), keeps the result synchronized as layout changes, and exposes that state to descendants through Vue's dependency injection.Synchronization happens in three situations:
Descendants can then consume the provided state with useViewerRect without prop drilling through intermediate components.