fix(ags): reset scroll on opening app and clip
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-05-20 23:10:04 -04:00
parent 0861880a20
commit e4384c5434

View file

@ -74,10 +74,21 @@ const makeChild = (class_name: string | Binding<any, any, string>) => {
hexpand: true, hexpand: true,
}); });
const scrollable = Scrollable({
hscroll: 'never',
vscroll: 'automatic',
child: Box({
vertical: true,
children: [list, placeholder],
}),
});
return { return {
list, list,
entry, entry,
placeholder, placeholder,
scrollable,
child: Box({ child: Box({
class_name, class_name,
vertical: true, vertical: true,
@ -90,14 +101,7 @@ const makeChild = (class_name: string | Binding<any, any, string>) => {
], ],
}), }),
Scrollable({ scrollable,
hscroll: 'never',
vscroll: 'automatic',
child: Box({
vertical: true,
children: [list, placeholder],
}),
}),
], ],
}), }),
}; };
@ -116,6 +120,7 @@ export class SortedList<
private _list: MakeChild['list']; private _list: MakeChild['list'];
private _entry: MakeChild['entry']; private _entry: MakeChild['entry'];
private _placeholder: MakeChild['placeholder']; private _placeholder: MakeChild['placeholder'];
private _scrollable: MakeChild['scrollable'];
private _on_select: (row: ListBoxRow) => void; private _on_select: (row: ListBoxRow) => void;
private _init_rows: (list: MakeChild['list']) => void; private _init_rows: (list: MakeChild['list']) => void;
private _set_sort: ( private _set_sort: (
@ -130,6 +135,10 @@ export class SortedList<
fun(this); fun(this);
this._init_rows(this._list); this._init_rows(this._list);
centerCursor(); centerCursor();
const adjustScroll = this._scrollable.vadjustment;
this._scrollable.vadjustment.set_value(adjustScroll.lower);
this._entry.grab_focus(); this._entry.grab_focus();
}; };
} }
@ -160,6 +169,7 @@ export class SortedList<
this._set_sort = set_sort; this._set_sort = set_sort;
this._placeholder = makeChildResult.placeholder; this._placeholder = makeChildResult.placeholder;
this._scrollable = makeChildResult.scrollable;
this._list = makeChildResult.list; this._list = makeChildResult.list;
this._list.on('row-activated', (_, row) => { this._list.on('row-activated', (_, row) => {