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,29 +425,39 @@ export class MessagesComponent implements OnInit, OnDestroy {
useSwap: boolean, useSwap: boolean,
addtionalOffset?: number addtionalOffset?: number
) { ) {
this.preSwapScroll(useHide, useSwap); if (!!to) {
if (!!preCallback) { this.preSwapScroll(useHide, useSwap);
preCallback(); 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);
});
} }
);
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();
}
}
} }
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
); );
} }
} }