perf(animation): improves _progress() hot function

- progress() is the function where more time is spent during any swipe gesture
- replace iterating over the _fx properties, using an array instead
- optimize pointerCoord(), profiler showed it’s one of the most called functions
This commit is contained in:
Manu Mtz.-Almeida
2016-11-16 19:48:35 +01:00
parent 70f8a8e5eb
commit c44f6b6f2e
5 changed files with 95 additions and 78 deletions

View File

@ -117,7 +117,7 @@ export class PanGesture {
let coord = pointerCoord(ev);
if (this.detector.detect(coord)) {
if (this.detector.pan() !== 0 && this.canCapture(ev) &&
if (this.detector.pan() !== 0 &&
(!this.gestute || this.gestute.capture())) {
this.onDragStart(ev);
this.captured = true;
@ -156,7 +156,6 @@ export class PanGesture {
// Implemented in a subclass
canStart(ev: any): boolean { return true; }
canCapture(ev: any): boolean { return true; }
onDragStart(ev: any) { }
onDragMove(ev: any) { }
onDragEnd(ev: any) { }