MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Hololens: Executing IWithMouseEvents.MouseEvent(...) releases MRTK's PointerDown.

Open
#3,624 5 comments 0 reactions 1 assignee View on GitHub

@champnic is already working on this.

Since Jul 10, 2023.

bug tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Description

Executing IWithMouseEvents.MouseEvent(...) releases MRTK's PointerDown.

Version
SDK: com.microsoft.mixedreality.webview.unity-0.17.1-pre.3.tgz
Runtime: Unity2021.3.24 (Run on Editor)
Framework: Unity2021.3.24, MRTK2.8.3
OS: Windows10 22H2

Regression
Was this working before but has regressed? > No.
If yes, what version did this last work on?

Repro Steps

  1. Clone this repository.
    https://github.com/MicrosoftEdge/WebView2Samples/
  2. Open this sample in UnityEditor.
    https://github.com/MicrosoftEdge/WebView2Samples/tree/main/GettingStartedGuides/HoloLens2_GettingStarted/HoloLens2GetStartedApp
  3. Attach this script to "Canvas"
using Microsoft.MixedReality.Toolkit.Input;
using Microsoft.MixedReality.WebView;
using UnityEngine;

public class Sample : MonoBehaviour, IMixedRealityPointerHandler
{
    private IWebView webView;

    private void Start()
    {
        GetComponentInChildren<WebView>().GetWebViewWhenReady((IWebView webView) =>
        {
            this.webView = webView;
        });
    }

    public void OnPointerDown(MixedRealityPointerEventData eventData)
    {
        Debug.Log("OnPointerDown");

        WebViewMouseEventData mouseEvent = new WebViewMouseEventData
        {
            X = 0,
            Y = 0,
            Type = WebViewMouseEventData.EventType.MouseDown,
            Button = WebViewMouseEventData.MouseButton.ButtonLeft,
            TertiaryAxisDeviceType = WebViewMouseEventData.TertiaryAxisDevice.PointingDevice
        };

        (webView as IWithMouseEvents).MouseEvent(mouseEvent);
    }

    public void OnPointerDragged(MixedRealityPointerEventData eventData)
    {
        Debug.Log("Dragged");
    }

    public void OnPointerUp(MixedRealityPointerEventData eventData)
    {
        Debug.Log("OnPointerUp");
    }

    public void OnPointerClicked(MixedRealityPointerEventData eventData)
    {
        
    }
}
  1. Run it, put the pointer on the Canvas and press the left mouse button.
  2. The following is logged to the console:
OnPointerDown
Dragged
OnPointerUp  

I expect only PointerDown (and Dragged) to be logged.
Commenting out this line gives the expected behavior.

(webView as IWithMouseEvents).MouseEvent(mouseEvent);

Screenshots
image

Additional context

AB#45473968

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.