PointerEventArgs.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. /// Event args to indicate a pointer event (i.e. mouse event).
  21. /// </summary>
  22. public class PointerEventArgs : EventArgs {
  23. /// <summary>
  24. /// The button for the event. The default is `MouseButton.Left`.
  25. /// </summary>
  26. public MouseButton Button = MouseButton.Left;
  27. /// <summary>
  28. /// The number of clicks for the event. For example, for a double click,
  29. /// set this value to `2`. The default is `1`.
  30. /// </summary>
  31. public int ClickCount = 1;
  32. /// <summary>
  33. /// The normalized pointer position passed to `IWebView.Click()`.
  34. /// </summary>
  35. public Vector2 Point;
  36. /// <summary>
  37. /// Converts the event args into `PointerOptions`
  38. /// that can be passed to methods like `PointerUp()` and `PointerDown()`.
  39. /// </summary>
  40. public PointerOptions ToPointerOptions() {
  41. return new PointerOptions {
  42. Button = Button,
  43. ClickCount = ClickCount
  44. };
  45. }
  46. }
  47. }