繁体   English   中英

Windows Phone 8.1的WebBrowser控件将忽略MSGestureHold

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

我正在更新我的浏览器应用程序以支持Windows Phone 8.1,并且我注意到未引发MSGestureHold事件。

要重现此错误,

  1. 下载MS迷你浏览器样本
  2. 将项目升级到Visual Studio 2013中的WP8.1项目,并添加IsScriptEnabled="True"
  3. 在WP8.1仿真器或设备上运行项目
  4. 导航至此触摸和鼠标示例
  5. 向下滚动至Sample 1: handling the hold gesture部分, 然后单击IE11用户测试

请注意, MSGestureHold无法正常工作。

但是,在进行测试时,该项目正在运行

  1. WP8和WP8.1的默认Windows Phone Internet Explorer应用
  2. WP8应用程序中的WebBrowser控件。

这是错误吗?

我猜这是WebBrowser控件的错误。

我使用针对WP8.1的WebBrowser控件测试了几个手势事件,例如: pointerdownMSGestureHoldMSGestureChangeMSGestureTap 最后,除MSGestureHold之外, pointerdownMSGestureChangeMSGestureTap均可正常触发。 所以我想这是一个错误

对于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