简体   繁体   English

Windows Phone 8.1的WebBrowser控件将忽略MSGestureHold

[英]MSGestureHold is ignored by WebBrowser Control for Windows Phone 8.1

I am updating my browser app to support Windows Phone 8.1 and I noticed the MSGestureHold event is not raised. 我正在更新我的浏览器应用程序以支持Windows Phone 8.1,并且我注意到未引发MSGestureHold事件。

To reproduce this error, 要重现此错误,

  1. Download the MS Mini-browser Sample . 下载MS迷你浏览器样本
  2. Upgrade the project to WP8.1 project in Visual Studio 2013 and add IsScriptEnabled="True" . 将项目升级到Visual Studio 2013中的WP8.1项目,并添加IsScriptEnabled="True"
  3. Run the project on WP8.1 emulator or device 在WP8.1仿真器或设备上运行项目
  4. Navigate to this touch and mouse example . 导航至此触摸和鼠标示例
  5. Scroll down to the Sample 1: handling the hold gesture section and click the IE11 users test . 向下滚动至Sample 1: handling the hold gesture部分, 然后单击IE11用户测试

Notice that MSGestureHold is not working. 请注意, MSGestureHold无法正常工作。

However the project is working when tested in 但是,在进行测试时,该项目正在运行

  1. Default Windows Phone Internet Explorer app for WP8 and WP8.1 WP8和WP8.1的默认Windows Phone Internet Explorer应用
  2. WebBrowser control in WP8 app. WP8应用程序中的WebBrowser控件。

Is this a bug? 这是错误吗?

I guess this is the WebBrowser control's bug. 我猜这是WebBrowser控件的错误。

I test several gesture events with WebBrowser control for WP8.1, such as pointerdown , MSGestureHold , MSGestureChange ,and MSGestureTap . 我使用针对WP8.1的WebBrowser控件测试了几个手势事件,例如: pointerdownMSGestureHoldMSGestureChangeMSGestureTap Finally, pointerdown , MSGestureChange and MSGestureTap can be triggered normally,except MSGestureHold . 最后,除MSGestureHold之外, pointerdownMSGestureChangeMSGestureTap均可正常触发。 So I guess this is a bug . 所以我想这是一个错误

This code works fine in webview for WPhone 8.1 apps : 对于WPhone 8.1应用程序,此代码在webview中可以正常工作:

var init = function(){
    var myState = // context
    var target = // DOM variable target
    var msg = new MSGesture();

    msg.target = target;

    target.addEventListener("MSGestureHold", function (evt) { buttonTactileListener.apply(myState, [evt, msg]); }, false);
    target.addEventListener("pointerdown", function (evt) { buttonTactileListener.apply(myState, [evt, msg]); }, false);
    target.addEventListener("MSGestureEnd", function (evt) { buttonTactileListener.apply(myState, [evt, msg]); }, false);
}
var buttonTactileListener = function (evt, msgesture) {
    var myState = this;
    if (evt.type == "pointerdown") {
        msgesture.addPointer(evt.pointerId);
        return;
    }
    if (evt.type == "MSGestureHold") {
        ///do something
        return;
    }

    if (evt.type == "MSGestureEnd") {
        // renew instance of handler
        msgesture = new MSGesture();
        msgesture.target = evt.target;
        return;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM