Skip to content

Commit

Permalink
fix(activator): do not activate elements while scrolling
Browse files Browse the repository at this point in the history
Closes #7141
  • Loading branch information
adamdbradley committed Jun 30, 2016
1 parent 0cb093e commit 845a516
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/components/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class App {
* @return {boolean}
*/
isScrolling(): boolean {
return (this._scrollTime + 64 > Date.now());
return (this._scrollTime + 48 > Date.now());
}

/**
Expand Down
20 changes: 7 additions & 13 deletions src/components/content/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ export class Content extends Ion {

constructor(
private _elementRef: ElementRef,
private _config: Config,
config: Config,
private _app: App,
private _keyboard: Keyboard,
private _zone: NgZone,
@Optional() viewCtrl: ViewController,
@Optional() private _tabs: Tabs
) {
super(_elementRef);
this._sbPadding = _config.getBoolean('statusbarPadding', false);
this._sbPadding = config.getBoolean('statusbarPadding', false);

if (viewCtrl) {
viewCtrl.setContent(this);
Expand All @@ -111,17 +111,11 @@ export class Content extends Ion {
* @private
*/
ngOnInit() {
let self = this;
self._scrollEle = self._elementRef.nativeElement.children[0];
this._scrollEle = this._elementRef.nativeElement.children[0];

This comment has been minimized.

Copy link
@manucorporat

manucorporat Jun 30, 2016

Contributor

@adamdbradley I love seeing var self = this; disappear ;)


self._zone.runOutsideAngular(function() {
self._scroll = new ScrollView(self._scrollEle);

if (self._config.getBoolean('tapPolyfill')) {
self._scLsn = self.addScrollListener(function() {
self._app.setScrolling();
});
}
this._zone.runOutsideAngular(() => {
this._scroll = new ScrollView(this._scrollEle);
this._scLsn = this.addScrollListener(this._app.setScrolling);
});
}

Expand All @@ -131,7 +125,7 @@ export class Content extends Ion {
ngOnDestroy() {
this._scLsn && this._scLsn();
this._scroll && this._scroll.destroy();
this._scrollEle = this._footerEle = this._scLsn = null;
this._scrollEle = this._footerEle = this._scLsn = this._scroll = null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/tap-click/tap-click.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class TapClick {
this.startCoord = pointerCoord(ev);

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.lastActivated = now;
}
Expand Down

0 comments on commit 845a516

Please sign in to comment.