Closed AlexMeah closed 7 years ago
@AlexMeah,
I apologize for not responding sooner. I don't know how I missed your PR, but I finally saw it today. I think your idea of exposing width and height is great! I would like to suggest we add a new property named elementDimensions to the output props. I like this approach because it may help to disambiguate the values and because it keeps the position property focused on x and y coordinates. The output props data structure would look like this:
{
elementDimensions: {
width: Number,
height: Number
}
isActive: Boolean,
isPositionOutside: Boolean,
position: {
x: Number,
y: Number
}
}
What are your thoughts?
I opened an Issue to track this feature and listed the tasks I think need to be performed. If you have time to do any of them, that is great. Otherwise, I will take some or all of them.
Thank you very much for opening this PR. You raised my awareness to a useful feature.
@AlexMeah - I want to thank you for opening this PR. You contributed the concept of exposing width and height and I think that helped to make the project better. I wanted to take the implementation in a slightly different direction, so I apologize for closing this in favor of https://github.com/ethanselzer/react-cursor-position/pull/8. The NPM package has been released @2.1.0. Let me know if you have any questions or concerns. Thanks again!
@ethanselzer Sorry I didn't get chance to implement it myself, https://github.com/ethanselzer/react-cursor-position/pull/8 looks great I'll switch away from my branch and start using it straight away :)
@AlexMeah - Thanks for your kind words and thanks for starring the project. I'm so glad you find react-cursor-position useful!
Not sure about the height being undefined happy to change it if it's a problem.