fix delay in status selection
This commit is contained in:
parent
0702063f69
commit
f925f08d00
|
@ -56,6 +56,7 @@ export class StatusComponent implements OnInit {
|
|||
this._statusWrapper = value;
|
||||
// console.warn(value.status);
|
||||
this.status = value.status;
|
||||
this.isSelected = value.isSelected;
|
||||
|
||||
if (this.status.reblog) {
|
||||
this.reblog = true;
|
||||
|
|
|
@ -159,12 +159,16 @@ export class ThreadComponent implements OnInit, OnDestroy {
|
|||
pipeline
|
||||
.then((status: Status) => {
|
||||
return this.mastodonService.getStatusContext(currentAccount, status.id)
|
||||
.then((context: Context) => {
|
||||
.then((context: Context) => {
|
||||
let contextStatuses = [...context.ancestors, status, ...context.descendants]
|
||||
const position = context.ancestors.length;
|
||||
|
||||
for (const s of contextStatuses) {
|
||||
const wrapper = new StatusWrapper(s, currentAccount);
|
||||
for (let i = 0; i < contextStatuses.length; i++) {
|
||||
let s = contextStatuses[i];
|
||||
const wrapper = new StatusWrapper(s, currentAccount);
|
||||
|
||||
if(i == position) wrapper.isSelected = true;
|
||||
|
||||
this.statuses.push(wrapper);
|
||||
}
|
||||
|
||||
|
@ -177,10 +181,9 @@ export class ThreadComponent implements OnInit, OnDestroy {
|
|||
.then((position: number) => {
|
||||
setTimeout(() => {
|
||||
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' });
|
||||
|
||||
scrollIntoView(el.elem.nativeElement, { behavior: 'smooth', block: 'nearest'});
|
||||
}, 250);
|
||||
})
|
||||
|
|
|
@ -17,4 +17,6 @@ export class StatusWrapper {
|
|||
public status: Status,
|
||||
public provider: AccountInfo
|
||||
) { }
|
||||
|
||||
public isSelected: boolean;
|
||||
}
|
Loading…
Reference in New Issue