简体   繁体   中英

I am getting a warning in the console when I listen for ionic gesture

'Touch.webkitRadiusX' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.radiusX' instead.

Whenever I listen to any gesture and try to log a message to the console to see if it is working I get the above warning. What is it and why is this happening?

It says it is coming from the ionic.bundle.js file.

EDIT

app.directive('detectGestures', function($ionicGesture) { return { restrict : 'A',

link : function(scope, elem, attrs) {
  var gestureType = attrs.gestureType;

  switch(gestureType) {
    case 'swipe':
      $ionicGesture.on('swipe', scope.reportEvent, elem);
      break;
    case 'swipeup':
      $ionicGesture.on('swipeup', scope.reportEvent, elem);
      break;
    case 'swipedown':
      $ionicGesture.on('swipedown', scope.reportEvent, elem);
      break;
    case 'swiperight':
      $ionicGesture.on('swiperight', scope.reportEvent, elem);
      break;
    case 'swipeleft':
      $ionicGesture.on('swipeleft', scope.reportEvent, elem);
      break;
    case 'doubletap':
      $ionicGesture.on('doubletap', scope.reportEvent, elem);
      break;
    case 'tap':
      $ionicGesture.on('tap', scope.reportEvent, elem);
      break;
    case 'scroll':
      $ionicGesture.on('scroll', scope.reportEvent, elem);
      break;
  }

}

}; });

I have reviewed the answer, but could you explain this dosen't work then? I mean it is great that it isn't the framework. However, I cannot get it to properly listen to the ionic gestures which is built on top of hammerjs, and that is the reason why I initially thought this message was indicating the use of a deprecated property. This comes up every time I log something to the console on an event such as swipe up, am I doing something wrong in this directive? I got it from an ionic codepen sample I believe.

According to Ionic team, you can ignore the warning because they don't use Touch.webkitRadiusX.

You can check this answer.

EDIT: So after your edit, your code looks fine. And i got it to work like this.

    var gestureType = attrs.gestureType;
    scope.reportEvent = function (e) {
        console.log(e);
    };
    $ionicGesture.on(gestureType, scope.reportEvent, elem);

And html

<custom-temp gesture-type="tap">
    </custom-temp>

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