add expand/collapse buttons to directories in tree view

This commit is contained in:
Sj-Si 2024-04-21 12:07:53 -04:00
parent 580711cdac
commit 7d953cc6c5
5 changed files with 106 additions and 16 deletions

View file

@ -188,22 +188,26 @@ class Clusterize {
}
async setMaxItems(max_items) {
/** Sets the new max number of items.
*
* This is used to control the scroll bar's length.
*
* Returns whether the number of max items changed.
*/
if (!this.setup_has_run || !this.enabled) {
this.#max_items = max_items;
return;
return this.#max_items !== max_items;
}
if (max_items === this.#max_items) {
if (this.#max_items === max_items) {
// No change. do nothing.
return;
return false;
}
// If the number of items changed, we need to update the cluster.
this.#max_items = max_items;
await this.refresh();
// Apply sort to the updated data.
await this.sortData();
return true;
}
// ==== PRIVATE FUNCTIONS ====