bug fixed

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

View File

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