IWithMovablePointer.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 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 details on the limitations of hover and drag interactions on iOS and UWP, please see
  22. /// https://support.vuplex.com/articles/hover-and-drag-limitations.
  23. /// </remarks>
  24. /// <remarks>
  25. /// The Android Gecko package doesn't support the HTML Drag and Drop API (GeckoView limitation).
  26. /// </remarks>
  27. /// <example>
  28. /// <code>
  29. /// var webViewWithMovablePointer = webViewPrefab.WebView as IWithMovablePointer;
  30. /// if (webViewWithMovablePointer == null) {
  31. /// Debug.Log("This 3D WebView plugin doesn't yet support IWithMovablePointer: " + webViewPrefab.WebView.PluginType);
  32. /// return;
  33. /// }
  34. /// // Move the pointer to (250px, 100px) in the web page.
  35. /// var normalizedPoint = webViewPrefab.WebView.PointToNormalized(250, 100);
  36. /// webViewWithMovablePointer.MovePointer(normalizedPoint);
  37. /// </code>
  38. /// </example>
  39. public interface IWithMovablePointer {
  40. /// <summary>
  41. /// Moves the pointer to the given normalized point in the web page.
  42. /// The optional `pointerLeave` parameter controls whether a pointerleave
  43. /// JavaScript event is fired to indicate that the pointer has left the webview.
  44. /// </summary>
  45. /// <remarks>
  46. /// This method can be used to trigger hover effects in the page or can be used
  47. /// in conjunction with IWithPointerDownAndUp to implement
  48. /// drag interactions.
  49. /// </remarks>
  50. void MovePointer(Vector2 normalizedPoint, bool pointerLeave = false);
  51. }
  52. }