bug fixed

This commit is contained in:
richard-loafle 2020-02-06 16:15:52 +09:00
parent 90918b3595
commit e518ed386e

View File

@ -425,39 +425,29 @@ export class MessagesComponent implements OnInit, OnDestroy {
useSwap: boolean,
addtionalOffset?: number
) {
if (!!to) {
this.preSwapScroll(useHide, useSwap);
if (!!preCallback) {
preCallback();
}
this.virtualScroller.scrollInto(
to,
true,
undefined !== this.storedScrollItemOffsetTop
? -this.storedScrollItemOffsetTop
: undefined !== addtionalOffset
? -addtionalOffset
: 0,
0,
() => {
setTimeout(() => {
if (!!postCallback) {
postCallback();
}
this.postSwapScroll(useHide, useSwap);
});
}
);
} else {
if (!!preCallback) {
preCallback();
}
if (!!postCallback) {
postCallback();
}
this.preSwapScroll(useHide, useSwap);
if (!!preCallback) {
preCallback();
}
this.virtualScroller.scrollInto(
to,
true,
undefined !== this.storedScrollItemOffsetTop
? -this.storedScrollItemOffsetTop
: undefined !== addtionalOffset
? -addtionalOffset
: 0,
0,
() => {
setTimeout(() => {
if (!!postCallback) {
postCallback();
}
this.postSwapScroll(useHide, useSwap);
});
}
);
}
preSwapScroll(useHide: boolean, useSwap: boolean) {
@ -540,6 +530,12 @@ export class MessagesComponent implements OnInit, OnDestroy {
return;
}
if (!!this.gotoEventSeq) {
this.gotoPosition(this.gotoEventSeq);
this.gotoEventSeq = undefined;
return;
}
const lastEvent =
!!this.eventList && 0 < this.eventList.length
? this.eventList[this.eventList.length - 1]
@ -550,20 +546,14 @@ export class MessagesComponent implements OnInit, OnDestroy {
}
const isInViewPortItems = this.isInViewPortItems(lastEvent.seq);
this.swapScrollTo(
!!this.gotoEventSeq
? undefined
: this.eventList[this.eventList.length - 1],
this.eventList[this.eventList.length - 1],
() => {},
() => {
this.initalized = true;
if (!!this.gotoEventSeq) {
this.gotoPosition(this.gotoEventSeq);
this.gotoEventSeq = undefined;
}
},
-1 === this.virtualScroller.viewPortInfo.endIndex ||
!isInViewPortItems,
!isInViewPortItems || !!this.gotoEventSeq
!isInViewPortItems
);
}
}