davidjerleke / embla-carousel

A lightweight carousel library with fluid motion and great swipe precision.
https://www.embla-carousel.com
MIT License
5.39k stars 166 forks source link

Make reading element dimensions work regardless of transforms #637

Closed davidjerleke closed 7 months ago

davidjerleke commented 7 months ago

Feature request is related to

Is your feature request related to an issue?

Originally posted by **javiergonzalezGenially** When using the carousel inside a container with a scale transform applied the carousel doesn't work properly because it uses to measure nodes getBoundingClientRect, which returns a rect which is already scaled.

Describe the solution you'd like

Originally posted by **javiergonzalezGenially** The proposed fix (tested working in the playground) uses instead offsetLeft/offsetWidth etc, which are unscaled.