Skip to content

v2.4.0

Compare
Choose a tag to compare
@joshwcomeau joshwcomeau released this 17 Jun 11:36
· 202 commits to master since this release

Add prop getPosition()

For calculating position, FlipMove uses getBoundingClientRect. This method provides the top/left/right/bottom positions of the element relative to the viewport, and it's how FlipMove figures out where stuff needs to be moved to.

Unfortunately, it fails in certain situations (eg. inside a scaled container).

This prop allows you to specify a custom function to be used instead of getBoundingClientRect. It accepts the DOM node as an argument and should return an object with top/left/right/bottom and width/height properties.

It is unlikely to be needed by most users, but a good escape hatch to have when those situations come up :)

Huge props to @Guuz for his work implementing this feature.