fix thread auto scroll

This commit is contained in:
Nicolas Constant 2019-10-07 23:46:03 -04:00
parent 0fe3cbce62
commit f9bf362935
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 6 additions and 5 deletions

View File

@ -9,6 +9,7 @@ import { NotificationService, NewReplyData } from '../../../services/notificatio
import { AccountInfo } from '../../../states/accounts.state'; import { AccountInfo } from '../../../states/accounts.state';
import { StatusWrapper } from '../../../models/common.model'; import { StatusWrapper } from '../../../models/common.model';
import { StatusComponent } from '../status/status.component'; import { StatusComponent } from '../status/status.component';
import scrollIntoView from 'scroll-into-view-if-needed';
@Component({ @Component({
selector: 'app-thread', selector: 'app-thread',
@ -177,11 +178,11 @@ export class ThreadComponent implements OnInit, OnDestroy {
setTimeout(() => { setTimeout(() => {
const el = this.statusChildren.toArray()[position]; const el = this.statusChildren.toArray()[position];
el.isSelected = true; el.isSelected = true;
// el.elem.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
// el.elem.nativeElement.scrollIntoView({ behavior: 'auto', block: 'start', inline: 'nearest' }); //el.elem.nativeElement.scrollIntoViewIfNeeded({ behavior: 'auto', block: 'start', inline: 'nearest' });
// el.elem.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
el.elem.nativeElement.scrollIntoViewIfNeeded({ behavior: 'auto', block: 'start', inline: 'nearest' }); scrollIntoView(el.elem.nativeElement, { behavior: 'smooth', block: 'nearest'});
}, 0); }, 250);
}) })
.catch((err: HttpErrorResponse) => { .catch((err: HttpErrorResponse) => {
this.notificationService.notifyHttpError(err, currentAccount); this.notificationService.notifyHttpError(err, currentAccount);