bug of search is fixed

This commit is contained in:
richard-loafle 2020-02-06 16:00:56 +09:00
parent 7308940001
commit 91cc673d80

View File

@ -425,6 +425,7 @@ 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();
@ -448,6 +449,15 @@ export class MessagesComponent implements OnInit, OnDestroy {
}); });
} }
); );
} else {
if (!!preCallback) {
preCallback();
}
if (!!postCallback) {
postCallback();
}
}
} }
preSwapScroll(useHide: boolean, useSwap: boolean) { preSwapScroll(useHide: boolean, useSwap: boolean) {
@ -526,6 +536,10 @@ export class MessagesComponent implements OnInit, OnDestroy {
false false
); );
} else { } else {
if (!this.eventList || 0 === this.eventList.length) {
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]
@ -536,7 +550,9 @@ export class MessagesComponent implements OnInit, OnDestroy {
} }
const isInViewPortItems = this.isInViewPortItems(lastEvent.seq); const isInViewPortItems = this.isInViewPortItems(lastEvent.seq);
this.swapScrollTo( this.swapScrollTo(
this.eventList[this.eventList.length - 1], !!this.gotoEventSeq
? undefined
: this.eventList[this.eventList.length - 1],
() => {}, () => {},
() => { () => {
this.initalized = true; this.initalized = true;
@ -547,7 +563,7 @@ export class MessagesComponent implements OnInit, OnDestroy {
}, },
-1 === this.virtualScroller.viewPortInfo.endIndex || -1 === this.virtualScroller.viewPortInfo.endIndex ||
!isInViewPortItems, !isInViewPortItems,
!isInViewPortItems !isInViewPortItems || !!this.gotoEventSeq
); );
} }
} }