简体   繁体   中英

About mouse move event in WP7 Phonegap

I am trying to create an application with Phonegap for Windows Phone 7.1. There is no touch event supported in IE9 Mobile (browser in WP7.1). Mouse events are what we have to use instead. It is fine till I have to click a button, or a link. But if I have to use some plugins for Phonegap for scroll or for slider or drag and drop elements, it doesn't work. What I found is that mousedown and mousemove events call at the same time.

I have downloaded thumbs.js https://issues.apache.org/jira/browse/CB-112

But it also didn't help.

I have tried something like this :

function onBodyLoad() {
     document.getElementById('divTest').attachEvent('onmousemove', mouseEventmove);            
}

function mouseEventmove(e) {
     document.getElementById('divTest').innerHTML = e.clientX + " & " + e.clientY;
}

but the mouseEventmove() is called after the combination of mousedown and then mouseup, ie a click. After adding thumbs.js and replacing the onBodyLoad() to

function onBodyLoad() {
         document.getElementById('divTest').attachEvent('ontouchmove', mouseEventmove);            
    }

Now it support touch event but again mouseEventmove() is called on a click.

Why is it so ? What should I do to let the WP7.1 support touch events or at least mouse move event.

thanks in advance

Jesse MacFayden, who is an Adobe developer on the PhoneGap team, has created a little utility class that can be used to emulate touch events on WP7:

https://github.com/apache/incubator-cordova-wp7/blob/master/templates/standalone/cordovalib/BrowserMouseHelper.cs

You can see it in action here:

http://phonegap.com/2012/05/22/windows-phone-apache-cordovaphonegap-hackathon/

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