calendar mode buttons change

This commit is contained in:
Yuri Kuznetsov
2024-03-30 13:12:09 +02:00
parent e78052ce33
commit bd0be4542e

View File

@@ -121,28 +121,19 @@ class CalendarModeButtons extends View {
}
});
if (currentIndex >= this.visibleModeListCount) {
const tmp = list[this.visibleModeListCount - 1];
list[this.visibleModeListCount - 1] = list[currentIndex];
list[currentIndex] = tmp;
}
return list;
}
getVisibleModeDataList() {
const fullList = this.getModeDataList();
const list = [];
const current = fullList.find(it => it.mode === this.mode);
fullList.forEach((o, i) => {
if (i >= this.visibleModeListCount) {
return;
}
const list = fullList.slice(0, this.visibleModeListCount);
list.push(o);
});
if (current && !list.find(it => it.mode === this.mode)) {
list.push(current);
}
return list;
}