IWithMovablePointer.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright (c) 2022 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. /// An interface implemented by a webview if it supports MovePointer(),
  18. /// which can be used to implement hover or drag interactions.
  19. /// </summary>
  20. /// <remarks>
  21. /// For information on the limitations of hover and drag interactions on iOS and UWP, please see
  22. /// https://support.vuplex.comarticles/hover-and-drag-limitations.
  23. /// </remarks>
  24. /// <example>
  25. /// <code>
  26. /// var webViewWithMovablePointer = webViewPrefab.WebView as IWithMovablePointer;
  27. /// if (webViewWithMovablePointer != null) {
  28. /// // Move the pointer to (250px, 100px) in the web page.
  29. /// var normalizedPoint = webViewPrefab.WebView.PointToNormalized(250, 100);
  30. /// webViewWithMovablePointer.MovePointer(normalizedPoint)
  31. /// }
  32. /// </code>
  33. /// </example>
  34. public interface IWithMovablePointer {
  35. /// <summary>
  36. /// Moves the pointer to the given normalized point in the web page.
  37. /// </summary>
  38. /// <remarks>
  39. /// This can be used to trigger hover effects in the page or can be used
  40. /// in conjunction with IWithPointerDownAndUp to implement
  41. /// drag interactions.
  42. /// </remarks>
  43. void MovePointer(Vector2 normalizedPoint);
  44. }
  45. }