PointerEventArgs.cs 1.8 KB

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