简体   繁体   中英

Alternate for `touchmove` in javascript event

Alternate for touchmove in javascript event. Once am using touchmove am getting a warning as follow.

'Touch.webkitRadiusX' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.radiusX' instead.
ionic.js:1155 'Touch.webkitRadiusY' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.radiusY' instead.
ionic.js:1155 'Touch.webkitRotationAngle' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.rotationAngle' instead.
ionic.js:1155 'Touch.webkitForce' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.force' instead.

Any help please.

You can use the built-in Ionic Gesture to track various touch event like : hold , tap , doubletap , drag , dragstart , dragend , dragup , dragdown , dragleft , dragright , swipe , swipeup , swipedown , swipeleft , swiperight , transform , transformstart , transformend , rotate , pinch , pinchin , pinchout , touch , release .

In your case, I think touchmove can be replaced with drag event. This event return the x, y for you.

This is how to use:

In your controller: Inject the $ionicGesture dependency.

myApp.controller('myCtrl', ['$ionicGesture', function($ionicGesture){
    $ionicGesture.on('drag', function (e) {
        //Your logic here.
        //You can use console.log(JSON.stringify(e, null, 2)) to check the object (x,y coors)
    })
}]);

More details at Ionic Docs Site

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