-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
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
Blazor's MouseEventArgs coordinates for SVGs are wrong! #15440
Comments
@Joebeazelman thanks for contacting us. I believe there are several issues associated with SVG right now. @SteveSandersonMS do you know of the top of your head if this is one of those? |
I don't specifically know. Blazor doesn't calculate any coordinates, but rather just passes through whatever data is supplied with the event by the browser. |
Thanks for contacting us, @Joebeazelman. We do plan to improve this in the future (probably during 5.0). |
I have used In
In the component:
|
Closing as we will be tackling this as part of #18271 |
The coordinates obtained from MouseEventArgs, namely clientX and clientY, during a mousedown event is wrong. It seems there's a constant offset applied to the coordinates. I suspect there's some kind of miscalculation occurring in Blazor. I haven't tested this on other elements types other than SVG.
At first, I thought it might have something to do with relative coordinates of the SVG child elements, but after adjusting for it, the coordinates are the same. When I implemented it in JavaScript, JavaScript returned the correct coordinates. Whatever MouseEventArgs is doing to the coordinates, it is wrong:
Almost identical code implemented in pure JS without Blazor running (SvgPoint, translation of points makes no difference):
The text was updated successfully, but these errors were encountered: