Skip to content

Commit 962578e

Browse files
committed
fix(content): fix scroll events
fixes #15244
1 parent 359c47f commit 962578e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

core/src/components/content/content.tsx

+8-6
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,18 @@ export class Content {
142142

143143
private onScroll(ev: UIEvent) {
144144
const timeStamp = Date.now();
145-
const didStart = !this.isScrolling;
145+
const shouldStart = !this.isScrolling;
146146
this.lastScroll = timeStamp;
147-
if (didStart) {
147+
if (shouldStart) {
148148
this.onScrollStart();
149+
149150
}
150151
if (!this.queued && this.scrollEvents) {
151152
this.queued = true;
152153
this.queue.read(ts => {
153154
this.queued = false;
154155
this.detail.event = ev;
155-
updateScrollDetail(this.detail, this.el, ts, didStart);
156+
updateScrollDetail(this.detail, this.scrollEl, ts, shouldStart);
156157
this.ionScroll.emit(this.detail);
157158
});
158159
}
@@ -337,21 +338,22 @@ function getPageElement(el: HTMLElement) {
337338
// ******** DOM READ ****************
338339
function updateScrollDetail(
339340
detail: ScrollDetail,
340-
el: HTMLElement,
341+
el: Element,
341342
timestamp: number,
342-
didStart: boolean
343+
shouldStart: boolean
343344
) {
344345
const prevX = detail.currentX;
345346
const prevY = detail.currentY;
346347
const prevT = detail.timeStamp;
347348
const currentX = el.scrollLeft;
348349
const currentY = el.scrollTop;
349-
if (didStart) {
350+
if (shouldStart) {
350351
// remember the start positions
351352
detail.startTimeStamp = timestamp;
352353
detail.startX = currentX;
353354
detail.startY = currentY;
354355
detail.velocityX = detail.velocityY = 0;
356+
console.log('hhhhhh');
355357
}
356358
detail.timeStamp = timestamp;
357359
detail.currentX = detail.scrollLeft = currentX;

0 commit comments

Comments
 (0)