简体   繁体   中英

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.

To reproduce this error,

  1. Download the MS Mini-browser Sample .
  2. Upgrade the project to WP8.1 project in Visual Studio 2013 and add IsScriptEnabled="True" .
  3. Run the project on WP8.1 emulator or device
  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 .

Notice that MSGestureHold is not working.

However the project is working when tested in

  1. Default Windows Phone Internet Explorer app for WP8 and WP8.1
  2. WebBrowser control in WP8 app.

Is this a bug?

I guess this is the WebBrowser control's bug.

I test several gesture events with WebBrowser control for WP8.1, such as pointerdown , MSGestureHold , MSGestureChange ,and MSGestureTap . Finally, pointerdown , MSGestureChange and MSGestureTap can be triggered normally,except MSGestureHold . So I guess this is a bug .

This code works fine in webview for WPhone 8.1 apps :

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;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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