Skip to content

0.0.5

Latest
Compare
Choose a tag to compare
@Bowen7 Bowen7 released this 03 May 07:47
· 1 commit to main since this release
ae27e2c

Return a more suitable ref

Previously, the ref will always return an SVGGElement when the element's type is one of path, circle, line, rect, ellipse, polygon, polyline. Because we wrap these types of elements in an SVGGElement and return the SVGGElement as the ref.

https://github.com/Bowen7/react-rough-fiber/blob/70f91aa7588ec8375dd53225d8ca74445a716f72/packages/react-rough-fiber/src/renderer.ts#L26-L32

Now, I have changed it to return the first path element of the SVGGElement.

It's just a better, not a perfect way to handle the ref. Because roughjs renders all shapes to SVGPathElement, we can't get the original ref.