Scroll tree elements to view even if they don't have a parent element.

This commit is contained in:
kovacsv 2021-11-07 19:03:13 +01:00
parent 4694fe640a
commit ff53c05bb2
2 changed files with 9 additions and 10 deletions

View File

@ -155,11 +155,6 @@ div.ov_toolbar div.ov_toolbar_button div.ov_svg_icon
padding: 10px;
}
div.ov_toolbar div.ov_toolbar_button.right
{
float: right;
}
div.ov_toolbar div.ov_toolbar_button.selected
{
background: var(--ov_toolbar_selected_color);

View File

@ -82,11 +82,15 @@ OV.TreeViewSingleItem = class extends OV.TreeViewItem
if (this.selected) {
this.mainElement.addClass ('selected');
let parent = this.parent;
while (parent !== null) {
parent.ShowChildren (true, () => {
OV.ScrollToView (this.mainElement);
});
parent = parent.parent;
if (parent === null) {
OV.ScrollToView (this.mainElement);
} else {
while (parent !== null) {
parent.ShowChildren (true, () => {
OV.ScrollToView (this.mainElement);
});
parent = parent.parent;
}
}
} else {
this.mainElement.removeClass ('selected');