We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useMeasure
SVGGraphicsElement
What is the current behavior?
Currently, useMeasure does not return the correct coordinates of an SVGGraphicsElement. In this MWE, useMeasure returns:
{ x: 0, y: 0, width: 50, height: 50, top: 0, left: 0, bottom: 0, right: 0 }
whereas getBBox() returns
getBBox()
{ x: 10, y: 10, width: 50, height: 50 }
for
<svg> <rect height={50} id="rectangle" ref={rectangle} width={50} x={10} y={10} /> </svg>
What is the expected behavior?
I would expect useMeasure to return a bounding box with the attributes x and y set to 10 as in the result of getBBox().
x
y
A little about versions:
react-use
The text was updated successfully, but these errors were encountered:
Hi all! @react-hookz/web, the new library by one of react-use's former maintainers (background here and here) has a new implementation of useMeasure that I think solves this.
For those interested, there's an official migration guide for migrating from react-use to @react-hookz/web.
Hope this helps!
Sorry, something went wrong.
No branches or pull requests
What is the current behavior?
Currently,
useMeasure
does not return the correct coordinates of anSVGGraphicsElement
. In this MWE,useMeasure
returns:whereas
getBBox()
returnsfor
What is the expected behavior?
I would expect
useMeasure
to return a bounding box with the attributesx
andy
set to 10 as in the result ofgetBBox()
.A little about versions:
react-use
: 17.2.3The text was updated successfully, but these errors were encountered: