-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Add OffsetX and OffsetY for touch events #41619
Comments
These properties are not part of the official spec for Touch Events: https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent The values for the Note however, you may be able to leverage the aspnetcore/src/Components/Web/src/Web/TouchPoint.cs Lines 19 to 49 in dc98f4b
|
@TanayParikh |
For consistency and maintainability we stick to the official spec as closely as possible for event args. Given these offset values aren't present in the official spec (ie. not shown in MDN), this isn't something we'd add to the
Extensions beyond the official specs are handled on a case-by-case basis based on community interest and functionality scope. As far as I know we haven't considered any expansions in the underlying |
This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes. See our Issue Management Policies for more information. |
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
onclick event in its
MouseEventArgs
hasOffsetX
andOffsetX
. These return coordinates in the current element. The coordinates are fine also when the element is scaled or transformed.There is no such functionality for touch events. Although onclick fires on short tap and oncontextmenu fires on long tap and they both fire event with MouseEventArgs which contains
OffsetX
andOffsetY
, ontouchstart and ontouchend don't haveOffsetX
andOffsetY
in their event args.This is crucial for applications like drawing on canvas which supports zooming and moving of the canvas within a parent container.
Calculating
OffsetX
andOffsetY
in such scenario is not possible afaik with plain Blazor and would require some complicated calculations via JS interop considering the fact that the canvas can be moved, zoomed and transformed within the parent container.Issues using JS interop:
The coordinates are exposed in
onclick
, thus they are probably known also when touch starts/ends. The issue is that they are not published.The events are fired in this sequence (depends of duration of the tap):
or
Describe the solution you'd like
Add OffsetX and OffsetY coordinates to TouchEventArgs. They are present in MouseEventArgs
Additional context
No response
The text was updated successfully, but these errors were encountered: