mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 16:16:41 +08:00
@ -142,17 +142,18 @@ export class Content {
|
|||||||
|
|
||||||
private onScroll(ev: UIEvent) {
|
private onScroll(ev: UIEvent) {
|
||||||
const timeStamp = Date.now();
|
const timeStamp = Date.now();
|
||||||
const didStart = !this.isScrolling;
|
const shouldStart = !this.isScrolling;
|
||||||
this.lastScroll = timeStamp;
|
this.lastScroll = timeStamp;
|
||||||
if (didStart) {
|
if (shouldStart) {
|
||||||
this.onScrollStart();
|
this.onScrollStart();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!this.queued && this.scrollEvents) {
|
if (!this.queued && this.scrollEvents) {
|
||||||
this.queued = true;
|
this.queued = true;
|
||||||
this.queue.read(ts => {
|
this.queue.read(ts => {
|
||||||
this.queued = false;
|
this.queued = false;
|
||||||
this.detail.event = ev;
|
this.detail.event = ev;
|
||||||
updateScrollDetail(this.detail, this.el, ts, didStart);
|
updateScrollDetail(this.detail, this.scrollEl, ts, shouldStart);
|
||||||
this.ionScroll.emit(this.detail);
|
this.ionScroll.emit(this.detail);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -337,21 +338,22 @@ function getPageElement(el: HTMLElement) {
|
|||||||
// ******** DOM READ ****************
|
// ******** DOM READ ****************
|
||||||
function updateScrollDetail(
|
function updateScrollDetail(
|
||||||
detail: ScrollDetail,
|
detail: ScrollDetail,
|
||||||
el: HTMLElement,
|
el: Element,
|
||||||
timestamp: number,
|
timestamp: number,
|
||||||
didStart: boolean
|
shouldStart: boolean
|
||||||
) {
|
) {
|
||||||
const prevX = detail.currentX;
|
const prevX = detail.currentX;
|
||||||
const prevY = detail.currentY;
|
const prevY = detail.currentY;
|
||||||
const prevT = detail.timeStamp;
|
const prevT = detail.timeStamp;
|
||||||
const currentX = el.scrollLeft;
|
const currentX = el.scrollLeft;
|
||||||
const currentY = el.scrollTop;
|
const currentY = el.scrollTop;
|
||||||
if (didStart) {
|
if (shouldStart) {
|
||||||
// remember the start positions
|
// remember the start positions
|
||||||
detail.startTimeStamp = timestamp;
|
detail.startTimeStamp = timestamp;
|
||||||
detail.startX = currentX;
|
detail.startX = currentX;
|
||||||
detail.startY = currentY;
|
detail.startY = currentY;
|
||||||
detail.velocityX = detail.velocityY = 0;
|
detail.velocityX = detail.velocityY = 0;
|
||||||
|
console.log('hhhhhh');
|
||||||
}
|
}
|
||||||
detail.timeStamp = timestamp;
|
detail.timeStamp = timestamp;
|
||||||
detail.currentX = detail.scrollLeft = currentX;
|
detail.currentX = detail.scrollLeft = currentX;
|
||||||
|
|||||||
Reference in New Issue
Block a user