IPointerInputDetector.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /**
  2. * Copyright (c) 2021 Vuplex Inc. All rights reserved.
  3. *
  4. * Licensed under the Vuplex Commercial Software Library License, you may
  5. * not use this file except in compliance with the License. You may obtain
  6. * a copy of the License at
  7. *
  8. * https://vuplex.com/commercial-library-license
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. using System;
  17. using UnityEngine;
  18. namespace Vuplex.WebView {
  19. /// <summary>
  20. /// An interface that can be passed to the `SetPointerInputDetector()` method of
  21. /// `WebViewPrefab` or `CanvasWebViewPrefab` to override how the prefab detects pointer input.
  22. /// For example implementations of this interface, see `DefaultPointerInputDetector`
  23. /// and `CanvasPointerInputDetector`.
  24. /// </summary>
  25. public interface IPointerInputDetector {
  26. /// <summary>
  27. /// Indicates the beginning of a drag interaction.
  28. /// </summary>
  29. /// <remarks>
  30. /// The EventArgs indicate the normalized point of the interaction, where the x and y components
  31. /// are values between 0 and 1 that are normalized to the width and height, respectively.
  32. /// </remarks>
  33. event EventHandler<EventArgs<Vector2>> BeganDrag;
  34. /// <summary>
  35. /// Indicates the continuation of a drag interaction.
  36. /// </summary>
  37. /// <remarks>
  38. /// The EventArgs indicate the normalized point of the interaction, where the x and y components
  39. /// are values between 0 and 1 that are normalized to the width and height, respectively.
  40. /// </remarks>
  41. event EventHandler<EventArgs<Vector2>> Dragged;
  42. /// <summary>
  43. /// Indicates a pointer down interaction occurred.
  44. /// </summary>
  45. event EventHandler<PointerEventArgs> PointerDown;
  46. /// <summary>
  47. /// Indicates that the pointer exited.
  48. /// </summary>
  49. event EventHandler PointerExited;
  50. /// <summary>
  51. /// Indicates that the pointer moved.
  52. /// </summary>
  53. /// <remarks>
  54. /// The EventArgs indicate the normalized point of the interaction, where the x and y components
  55. /// are values between 0 and 1 that are normalized to the width and height, respectively.
  56. /// </remarks>
  57. event EventHandler<EventArgs<Vector2>> PointerMoved;
  58. /// <summary>
  59. /// Indicates a pointer up interaction occurred.
  60. /// </summary>
  61. event EventHandler<PointerEventArgs> PointerUp;
  62. /// <summary>
  63. /// Indicates a scroll interaction occurred.
  64. /// </summary>
  65. event EventHandler<ScrolledEventArgs> Scrolled;
  66. /// <summary>
  67. /// The prefab sets this property to indicate whether
  68. /// the `PointerMoved` event should be enabled.
  69. /// </summary>
  70. bool PointerMovedEnabled { get; set; }
  71. }
  72. }