Material: feat(gesture): need ability to disable all gestures for perf

Created on 5 Sep 2017  路  7Comments  路  Source: angular/material

When I remove this function: attachToDocument everything works extremely faster. In addition, when you take a snapshot of memory with having that function we'd see lots of detached DOM nodes held by gestureStart function which is never release them. Saying that please anybody assist me how to avoid gestures in my SPA and make its life easier. (the app wont be used on mobile devices)

important Pull Request fixed performance feature gestures performance

Most helpful comment

Note that v1.1.6 is scheduled for 2 months from now!

To get this^ change sooner - After the v1.1.5 release - you can easily fork this repository, locally merge the PR, and build your own version of ngM1.

All 7 comments

@AndrewEastwood - you should be able to configure the $mdGesture to skip click hijacks (which also disables the attachToDocument() code.

// In the angular `config` phase...
app.config(function($mdGestureProvider) {   
    // To skip attachToDocument() and addEventListener(s)
    $mdGestureProvider.skipClickHijack();     
});

That's right. But still this part will is not under conditions and will add extra listeners to document:

  // Listen to all events to cover all platforms.
  var START_EVENTS = 'mousedown touchstart pointerdown';
  var MOVE_EVENTS = 'mousemove touchmove pointermove';
  var END_EVENTS = 'mouseup mouseleave touchend touchcancel pointerup pointercancel';

  angular.element(document)
    .on(START_EVENTS, gestureStart)
    .on(MOVE_EVENTS, gestureMove)
    .on(END_EVENTS, gestureEnd)
    // For testing
    .on('$$mdGestureReset', function gestureClearCache () {
      lastPointer = pointer = null;
    });

@AndrewEastwood - Check out PR #10885.

The memory leak issue still needs to be investigate.

@ThomasBurleson, that would be awesome update! thanks!

Note that v1.1.6 is scheduled for 2 months from now!

To get this^ change sooner - After the v1.1.5 release - you can easily fork this repository, locally merge the PR, and build your own version of ngM1.

gotcha

New PR https://github.com/angular/material/pull/11246 posted to allow disabling all gestures for perf. Hopefully we can get it into 1.1.9 next week.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kasajian picture kasajian  路  3Comments

chriseyhorn picture chriseyhorn  路  3Comments

buzybee83 picture buzybee83  路  3Comments

Dona278 picture Dona278  路  3Comments

robertmesserle picture robertmesserle  路  3Comments