mirror of
https://github.com/clangen/musikcube.git
synced 2025-03-14 13:21:13 +00:00
Fixed bug in ApplyHeaderOffset calculation.
This commit is contained in:
parent
8c9117f437
commit
9ce7f1a030
@ -294,15 +294,18 @@ size_t TrackListView::HeaderCalculator::AdapterToTrackListIndex(size_t index) {
|
||||
}
|
||||
|
||||
size_t TrackListView::HeaderCalculator::TrackListToAdapterIndex(size_t index) {
|
||||
return (index == 0 && this->rawOffsets && this->rawOffsets->size() > 0)
|
||||
? 1 : this->ApplyHeaderOffset(index, 1); /* meh... */
|
||||
if (!this->rawOffsets || this->rawOffsets->size() == 0) {
|
||||
return index;
|
||||
}
|
||||
|
||||
return this->ApplyHeaderOffset(index, 1);
|
||||
}
|
||||
|
||||
size_t TrackListView::HeaderCalculator::ApplyHeaderOffset(size_t index, int delta) {
|
||||
size_t result = index;
|
||||
if (this->absoluteOffsets) {
|
||||
for (auto offset : (*this->absoluteOffsets)) {
|
||||
if (result != 0 && offset <= index) {
|
||||
if (result != 0 && offset <= result) {
|
||||
result += delta;
|
||||
}
|
||||
else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user