[英]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, 要重现此错误,
IsScriptEnabled="True"
. 将项目升级到Visual Studio 2013中的WP8.1项目,并添加IsScriptEnabled="True"
。 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 但是,在进行测试时,该项目正在运行
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控件测试了几个手势事件,例如: pointerdown , MSGestureHold , MSGestureChange和MSGestureTap 。 Finally, pointerdown , MSGestureChange and MSGestureTap can be triggered normally,except MSGestureHold . 最后,除MSGestureHold之外, pointerdown , MSGestureChange和MSGestureTap均可正常触发。 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.