Skip to content

Commit

Permalink
fix(content): fix scroll events
Browse files Browse the repository at this point in the history
fixes #15244
  • Loading branch information
manucorporat committed Aug 20, 2018
1 parent 359c47f commit 962578e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions core/src/components/content/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,18 @@ export class Content {

private onScroll(ev: UIEvent) {
const timeStamp = Date.now();
const didStart = !this.isScrolling;
const shouldStart = !this.isScrolling;
this.lastScroll = timeStamp;
if (didStart) {
if (shouldStart) {
this.onScrollStart();

}
if (!this.queued && this.scrollEvents) {
this.queued = true;
this.queue.read(ts => {
this.queued = false;
this.detail.event = ev;
updateScrollDetail(this.detail, this.el, ts, didStart);
updateScrollDetail(this.detail, this.scrollEl, ts, shouldStart);
this.ionScroll.emit(this.detail);
});
}
Expand Down Expand Up @@ -337,21 +338,22 @@ function getPageElement(el: HTMLElement) {
// ******** DOM READ ****************
function updateScrollDetail(
detail: ScrollDetail,
el: HTMLElement,
el: Element,
timestamp: number,
didStart: boolean
shouldStart: boolean
) {
const prevX = detail.currentX;
const prevY = detail.currentY;
const prevT = detail.timeStamp;
const currentX = el.scrollLeft;
const currentY = el.scrollTop;
if (didStart) {
if (shouldStart) {
// remember the start positions
detail.startTimeStamp = timestamp;
detail.startX = currentX;
detail.startY = currentY;
detail.velocityX = detail.velocityY = 0;
console.log('hhhhhh');

This comment has been minimized.

Copy link
@ptitjes

ptitjes Aug 20, 2018

Contributor

Oups :p

}
detail.timeStamp = timestamp;
detail.currentX = detail.scrollLeft = currentX;
Expand Down

0 comments on commit 962578e

Please sign in to comment.