简体   繁体   English

在JavaScript事件中替代`touchmove`

[英]Alternate for `touchmove` in javascript event

Alternate for touchmove in javascript event. 替代JavaScript事件中的touchmove Once am using touchmove am getting a warning as follow. 一旦使用touchmove收到如下警告。

'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 . 您可以使用内置的离子手势跟踪各种触摸事件,例如: holdtapdoubletapdragdragstartdragenddragupdragdowndragleftdragrightswipeswipeupswipedownswipeleftswiperighttransformtransformstarttransformendrotatepinchpinchinpinchouttouchrelease

In your case, I think touchmove can be replaced with drag event. 就您而言,我认为touchmove可以替换为drag事件。 This event return the x, y for you. 此事件为您返回x,y。

This is how to use: 这是使用方法:

In your controller: Inject the $ionicGesture dependency. 在您的控制器中:注入$ionicGesture依赖项。

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 Ionic Docs网站上了解更多详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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