From 1a58a41cf90e374aebd73df35ad896537950c334 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Tue, 21 Jun 2016 17:26:07 +0200 Subject: [PATCH] fix(refresher): only listen for mousemove/touchmove when needed --- src/components/refresher/refresher.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/refresher/refresher.ts b/src/components/refresher/refresher.ts index d580c9195b..06a9c72927 100644 --- a/src/components/refresher/refresher.ts +++ b/src/components/refresher/refresher.ts @@ -151,7 +151,7 @@ export class Refresher { * will automatically go into the `refreshing` state. By default, the pull * maximum will be the result of `pullMin + 60`. */ - @Input() pullMax: number = null; + @Input() pullMax: number = this.pullMin + 60; /** * @input {number} How many milliseconds it takes to close the refresher. Default is `280`. @@ -219,16 +219,23 @@ export class Refresher { if (ev.touches && ev.touches.length > 1) { return false; } + if (this.state !== STATE_INACTIVE) { + return false; + } + + let scrollHostScrollTop = this._content.getContentDimensions().scrollTop; + // if the scrollTop is greater than zero then it's + // not possible to pull the content down yet + if (scrollHostScrollTop > 0) { + return false; + } let coord = pointerCoord(ev); console.debug('Pull-to-refresh, onStart', ev.type, 'y:', coord.y); this.startY = this.currentY = coord.y; this.progress = 0; - - if (!this.pullMax) { - this.pullMax = (this.pullMin + 60); - } + this.state = STATE_PULLING; return true; }