user3832583
user3832583

Reputation: 371

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.

Upvotes: 0

Views: 274

Answers (1)

cagica
cagica

Reputation: 679

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>

Upvotes: 1

Related Questions