souporserious / get-node-dimensions

Get accurate element dimensions, even if it's hidden!
MIT License
20 stars 5 forks source link

Cloning elements is removing decimals #5

Open bookman25 opened 7 years ago

bookman25 commented 7 years ago

Currently when an element is not cloned, it's using the actual width including decimal points. But when cloning it's rounding.

I believe the first option is more correct: https://github.com/souporserious/get-node-dimensions/blob/master/src/get-node-dimensions.js#L24-L25

I think this should be updated to just return rect and not use the offset's: https://github.com/souporserious/get-node-dimensions/blob/master/src/get-clone-dimensions.js#L39-L40

souporserious commented 7 years ago

Ah I can't remember why I would have done this. It might have had to with getBoundingClientRect taking transforms into account or something. I'll look into this. Thanks for letting me know :)