fix(activator): do not activate elements while scrolling

Closes #7141
This commit is contained in:
Adam Bradley
2016-06-30 10:36:03 -05:00
parent 0cb093e394
commit 845a516375
3 changed files with 9 additions and 15 deletions

View File

@ -107,7 +107,7 @@ export class App {
* @return {boolean} * @return {boolean}
*/ */
isScrolling(): boolean { isScrolling(): boolean {
return (this._scrollTime + 64 > Date.now()); return (this._scrollTime + 48 > Date.now());
} }
/** /**

View File

@ -91,7 +91,7 @@ export class Content extends Ion {
constructor( constructor(
private _elementRef: ElementRef, private _elementRef: ElementRef,
private _config: Config, config: Config,
private _app: App, private _app: App,
private _keyboard: Keyboard, private _keyboard: Keyboard,
private _zone: NgZone, private _zone: NgZone,
@ -99,7 +99,7 @@ export class Content extends Ion {
@Optional() private _tabs: Tabs @Optional() private _tabs: Tabs
) { ) {
super(_elementRef); super(_elementRef);
this._sbPadding = _config.getBoolean('statusbarPadding', false); this._sbPadding = config.getBoolean('statusbarPadding', false);
if (viewCtrl) { if (viewCtrl) {
viewCtrl.setContent(this); viewCtrl.setContent(this);
@ -111,17 +111,11 @@ export class Content extends Ion {
* @private * @private
*/ */
ngOnInit() { ngOnInit() {
let self = this; this._scrollEle = this._elementRef.nativeElement.children[0];
self._scrollEle = self._elementRef.nativeElement.children[0];
self._zone.runOutsideAngular(function() { this._zone.runOutsideAngular(() => {
self._scroll = new ScrollView(self._scrollEle); this._scroll = new ScrollView(this._scrollEle);
this._scLsn = this.addScrollListener(this._app.setScrolling);
if (self._config.getBoolean('tapPolyfill')) {
self._scLsn = self.addScrollListener(function() {
self._app.setScrolling();
});
}
}); });
} }
@ -131,7 +125,7 @@ export class Content extends Ion {
ngOnDestroy() { ngOnDestroy() {
this._scLsn && this._scLsn(); this._scLsn && this._scLsn();
this._scroll && this._scroll.destroy(); this._scroll && this._scroll.destroy();
this._scrollEle = this._footerEle = this._scLsn = null; this._scrollEle = this._footerEle = this._scLsn = this._scroll = null;
} }
/** /**

View File

@ -122,7 +122,7 @@ export class TapClick {
this.startCoord = pointerCoord(ev); this.startCoord = pointerCoord(ev);
let now = Date.now(); let now = Date.now();
if (this.lastActivated + 150 < now) { if (this.lastActivated + 150 < now && !this.app.isScrolling()) {
this.activator && this.activator.downAction(ev, activatableEle, this.startCoord); this.activator && this.activator.downAction(ev, activatableEle, this.startCoord);
this.lastActivated = now; this.lastActivated = now;
} }