Open ritchieanesco opened 7 months ago
You're welcome! :pray: Hmm, maybe.
Currently onResize reports width and height, and it reports the requested kind of dimensions (content- or border box size), using borderBoxSize, contentBoxSize, or the old contentRect prop.
Only contentRect has properties other than width / height, and it seems a bit accidental if I'm honest from an early implementation, as outlined in the MDN docs.
I would rather consider a lower-level implementation to hook onto, something like onEntry
reporting the entire entry object itself as an escape hatch, allowing to implement something like this. :thinking:
So basically I would keep the current useResizeObserver as-is, to preserve its size observing API and optimisations, and could just add another lower-level hook called something like useResizeObserverEntry
, with an onChange method :thinking:
Thank you for the great library!!
Just wondering if there were any plans to expose the element's
x
,y
,top
,left
, etc. coordinates since you are already accessing dimensions from contentRect?