TouchEvent.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright (c) 2024 Vuplex Inc. All rights reserved.
  2. //
  3. // Licensed under the Vuplex Commercial Software Library License, you may
  4. // not use this file except in compliance with the License. You may obtain
  5. // a copy of the License at
  6. //
  7. // https://vuplex.com/commercial-library-license
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. using UnityEngine;
  15. namespace Vuplex.WebView {
  16. /// <summary>
  17. /// A touch event that can be dispatched with IWithTouch.SendTouchEvent().
  18. /// </summary>
  19. public struct TouchEvent {
  20. /// <summary>
  21. /// ID of the touch. This value must be unique per touch but is shared by all
  22. /// events for the same touch (i.e. the Start, Move, and End events for a
  23. /// single touch share the same TouchID). This can be any number except -1, and
  24. /// a maximum of 16 concurrent touches are tracked.
  25. /// </summary>
  26. public int TouchID;
  27. /// <summary>
  28. /// The touch event type. Touches begin with one TouchEventType.Start event,
  29. /// followed by zero or more TouchEventType.Move events, and finally one TouchEventType.End
  30. /// or TouchEventType.Cancel event.
  31. /// </summary>
  32. public TouchEventType Type;
  33. /// <summary>
  34. /// The normalized point of the touch event.
  35. /// </summary>
  36. public Vector2 Point;
  37. /// <summary>
  38. /// (optional) The X radius of the touch in pixels. If not set, the default
  39. /// value of 25px will be used.
  40. /// </summary>
  41. public float RadiusX;
  42. /// <summary>
  43. /// (optional) The Y radius of the touch in pixels. If not set, the default
  44. /// value of 25px will be used.
  45. /// </summary>
  46. public float RadiusY;
  47. /// <summary>
  48. /// (optional) The rotation angle in radians.
  49. /// </summary>
  50. public float RotationAngle;
  51. /// <summary>
  52. /// (optional) The normalized pressure of the touch in the range of [0, 1].
  53. /// </summary>
  54. public float Pressure;
  55. }
  56. }