IWithPointerDownAndUp.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 UnityEngine;
  17. namespace Vuplex.WebView {
  18. /// <summary>
  19. /// An interface implemented by a webview if it supports `PointerDown()`
  20. /// and `PointerUp()`, which can be used to implement functionality like
  21. /// drag-and-drop, double-clicks, and right-clicks.
  22. /// </summary>
  23. public interface IWithPointerDownAndUp {
  24. /// <summary>
  25. /// Dispatches a "mouse down" click event.
  26. /// This can be used in conjunction with `IWithMovablePointer.MovePointer` and
  27. /// `PointerUp` to implement drag-and-drop interactions.
  28. /// </summary>
  29. /// <param name="point">
  30. /// The x and y components of the point are values
  31. /// between 0 and 1 that are normalized to the width and height, respectively. For example,
  32. /// `point.x = x in Unity units / width in Unity units`.
  33. /// Like in the browser, the origin is in the upper-left corner,
  34. /// the positive direction of the y-axis is down, and the positive
  35. /// direction of the x-axis is right.
  36. /// </param>
  37. /// <seealso cref="IWebView.Click"/>
  38. void PointerDown(Vector2 point);
  39. /// <summary>
  40. /// Like `PointerDown(Vector2)`, except it also accepts a
  41. /// `PointerOptions` parameter to modify the behavior
  42. /// (e.g. to trigger a right click or a double click).
  43. /// </summary>
  44. void PointerDown(Vector2 point, PointerOptions options);
  45. /// <summary>
  46. /// Dispatches a mouse up click event.
  47. /// This can be used in conjunction with `PointerDown` and
  48. /// `IWithMovablePointer.MovePointer` and to implement drag-and-drop interactions.
  49. /// </summary>
  50. /// <param name="point">
  51. /// The x and y components of the point are values
  52. /// between 0 and 1 that are normalized to the width and height, respectively. For example,
  53. /// `point.x = x in Unity units / width in Unity units`.
  54. /// Like in the browser, the origin is in the upper-left corner,
  55. /// the positive direction of the y-axis is down, and the positive
  56. /// direction of the x-axis is right.
  57. /// </param>
  58. /// <seealso cref="Click"/>
  59. void PointerUp(Vector2 point);
  60. /// <summary>
  61. /// Like `PointerUp(Vector2)`, except it also accepts a
  62. /// `PointerOptions` parameter to modify the behavior
  63. /// (e.g. to trigger a right click or a double click).
  64. /// </summary>
  65. void PointerUp(Vector2 point, PointerOptions options);
  66. }
  67. }