fix delay in status selection

This commit is contained in:
Nicolas Constant 2020-02-14 19:59:45 -05:00
parent 0702063f69
commit f925f08d00
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
3 changed files with 12 additions and 6 deletions

View File

@ -56,6 +56,7 @@ export class StatusComponent implements OnInit {
this._statusWrapper = value; this._statusWrapper = value;
// console.warn(value.status); // console.warn(value.status);
this.status = value.status; this.status = value.status;
this.isSelected = value.isSelected;
if (this.status.reblog) { if (this.status.reblog) {
this.reblog = true; this.reblog = true;

View File

@ -163,8 +163,12 @@ export class ThreadComponent implements OnInit, OnDestroy {
let contextStatuses = [...context.ancestors, status, ...context.descendants] let contextStatuses = [...context.ancestors, status, ...context.descendants]
const position = context.ancestors.length; const position = context.ancestors.length;
for (const s of contextStatuses) { for (let i = 0; i < contextStatuses.length; i++) {
let s = contextStatuses[i];
const wrapper = new StatusWrapper(s, currentAccount); const wrapper = new StatusWrapper(s, currentAccount);
if(i == position) wrapper.isSelected = true;
this.statuses.push(wrapper); this.statuses.push(wrapper);
} }
@ -177,7 +181,6 @@ export class ThreadComponent implements OnInit, OnDestroy {
.then((position: number) => { .then((position: number) => {
setTimeout(() => { setTimeout(() => {
const el = this.statusChildren.toArray()[position]; const el = this.statusChildren.toArray()[position];
el.isSelected = true;
//el.elem.nativeElement.scrollIntoViewIfNeeded({ behavior: 'auto', block: 'start', inline: 'nearest' }); //el.elem.nativeElement.scrollIntoViewIfNeeded({ behavior: 'auto', block: 'start', inline: 'nearest' });

View File

@ -17,4 +17,6 @@ export class StatusWrapper {
public status: Status, public status: Status,
public provider: AccountInfo public provider: AccountInfo
) { } ) { }
public isSelected: boolean;
} }