more rendering is implemented
This commit is contained in:
parent
49cc27c257
commit
852eb6314f
|
@ -12,11 +12,7 @@
|
||||||
[modifyOverflowStyleOfParentScroll]="false"
|
[modifyOverflowStyleOfParentScroll]="false"
|
||||||
(vsChange)="onVsChange($event)"
|
(vsChange)="onVsChange($event)"
|
||||||
>
|
>
|
||||||
<div
|
<div #chatMessagesContainer class="chat-messages">
|
||||||
#chatMessagesContainer
|
|
||||||
class="chat-messages hide"
|
|
||||||
[style.opacity]="fixScreen ? 0 : 1"
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
*ngIf="eventRemained && eventList.length > 0"
|
*ngIf="eventRemained && eventList.length > 0"
|
||||||
class="message-row view-previous"
|
class="message-row view-previous"
|
||||||
|
@ -83,3 +79,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</virtual-scroller>
|
</virtual-scroller>
|
||||||
|
|
||||||
|
<div
|
||||||
|
#chatMessagesBuffer
|
||||||
|
fxFlexFill
|
||||||
|
class="chat-messages-buffer disappear"
|
||||||
|
></div>
|
||||||
|
|
|
@ -189,3 +189,15 @@ $meBox-bg: #ffffff;
|
||||||
.hide {
|
.hide {
|
||||||
opacity: 0 !important;
|
opacity: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disappear {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-messages-buffer {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
overflow-y: hidden !important;
|
||||||
|
padding: 30px 40px;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
|
@ -108,6 +108,9 @@ export class MessagesComponent implements OnInit, OnDestroy {
|
||||||
@ViewChild('chatMessagesContainer', { static: false })
|
@ViewChild('chatMessagesContainer', { static: false })
|
||||||
chatMessagesContainer: ElementRef<HTMLElement>;
|
chatMessagesContainer: ElementRef<HTMLElement>;
|
||||||
|
|
||||||
|
@ViewChild('chatMessagesBuffer', { static: false })
|
||||||
|
chatMessagesBuffer: ElementRef<HTMLElement>;
|
||||||
|
|
||||||
@ViewChild(PerfectScrollbarDirective, { static: false })
|
@ViewChild(PerfectScrollbarDirective, { static: false })
|
||||||
psChatContent: PerfectScrollbarDirective;
|
psChatContent: PerfectScrollbarDirective;
|
||||||
|
|
||||||
|
@ -142,7 +145,6 @@ export class MessagesComponent implements OnInit, OnDestroy {
|
||||||
moment = moment;
|
moment = moment;
|
||||||
|
|
||||||
existReadHere = false;
|
existReadHere = false;
|
||||||
fixScreen = false;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private logger: NGXLogger,
|
private logger: NGXLogger,
|
||||||
|
@ -382,11 +384,13 @@ export class MessagesComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollToStoredItem() {
|
scrollToStoredItem() {
|
||||||
if (!this.scrollUpInitalized) {
|
|
||||||
this.chatMessagesContainer.nativeElement.classList.remove('hide');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.virtualScroller.scrollInto(this.storedScrollItem, true, 0, 0, () => {
|
this.virtualScroller.scrollInto(this.storedScrollItem, true, 0, 0, () => {
|
||||||
|
this.chatMessagesBuffer.nativeElement.innerHTML = '';
|
||||||
|
this.chatMessagesBuffer.nativeElement.scrollTop = 0;
|
||||||
|
|
||||||
|
this.chatMessagesBuffer.nativeElement.classList.add('disappear');
|
||||||
|
this.chatMessagesContainer.nativeElement.classList.remove('hide');
|
||||||
|
|
||||||
this.storedScrollItem = undefined;
|
this.storedScrollItem = undefined;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -472,10 +476,7 @@ export class MessagesComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
if (!!this.virtualScroller) {
|
if (!!this.virtualScroller) {
|
||||||
const e = this.eventList.find(v => v.seq === eventSeq);
|
const e = this.eventList.find(v => v.seq === eventSeq);
|
||||||
this.fixScreen = true;
|
this.virtualScroller.scrollInto(e, false, undefined, 0, () => {});
|
||||||
this.virtualScroller.scrollInto(e, false, undefined, 0, () => {
|
|
||||||
this.fixScreen = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,6 +492,13 @@ export class MessagesComponent implements OnInit, OnDestroy {
|
||||||
// this.storedScrollItem = this.psChatContent.elementRef.nativeElement.scrollHeight;
|
// this.storedScrollItem = this.psChatContent.elementRef.nativeElement.scrollHeight;
|
||||||
this.storeScrollPosition();
|
this.storeScrollPosition();
|
||||||
|
|
||||||
|
this.chatMessagesBuffer.nativeElement.innerHTML = this.chatMessagesContainer.nativeElement.innerHTML;
|
||||||
|
this.chatMessagesBuffer.nativeElement.scrollTop = this.chatMessagesContainer.nativeElement.scrollTop;
|
||||||
|
|
||||||
|
this.chatMessagesBuffer.nativeElement.classList.remove('disappear');
|
||||||
|
this.chatMessagesContainer.nativeElement.classList.add('hide');
|
||||||
|
this.changeDetectorRef.detectChanges();
|
||||||
|
|
||||||
this.moreEvent.emit(this.eventList[0].seq);
|
this.moreEvent.emit(this.eventList[0].seq);
|
||||||
|
|
||||||
this.virtualScroller.invalidateCachedMeasurementAtIndex(0);
|
this.virtualScroller.invalidateCachedMeasurementAtIndex(0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user