| @@ -295,15 +295,23 @@ public: | |||||
| setViewedComponent (content.release()); | setViewedComponent (content.release()); | ||||
| } | } | ||||
| RowComponent* getComponentForRow (const int row) const noexcept | |||||
| RowComponent* getComponentForRow (int row) const noexcept | |||||
| { | { | ||||
| return rows [row % jmax (1, rows.size())]; | |||||
| if (isPositiveAndBelow (row, rows.size())) | |||||
| return rows[row]; | |||||
| return nullptr; | |||||
| } | |||||
| RowComponent* getComponentForRowWrapped (int row) const noexcept | |||||
| { | |||||
| return rows[row % jmax (1, rows.size())]; | |||||
| } | } | ||||
| RowComponent* getComponentForRowIfOnscreen (const int row) const noexcept | |||||
| RowComponent* getComponentForRowIfOnscreen (int row) const noexcept | |||||
| { | { | ||||
| return (row >= firstIndex && row < firstIndex + rows.size()) | return (row >= firstIndex && row < firstIndex + rows.size()) | ||||
| ? getComponentForRow (row) : nullptr; | |||||
| ? getComponentForRowWrapped (row) : nullptr; | |||||
| } | } | ||||
| int getRowNumberOfComponent (Component* const rowComponent) const noexcept | int getRowNumberOfComponent (Component* const rowComponent) const noexcept | ||||
| @@ -377,7 +385,7 @@ public: | |||||
| { | { | ||||
| const int row = i + startIndex; | const int row = i + startIndex; | ||||
| if (auto* rowComp = getComponentForRow (row)) | |||||
| if (auto* rowComp = getComponentForRowWrapped (row)) | |||||
| { | { | ||||
| rowComp->setBounds (0, row * rowH, w, rowH); | rowComp->setBounds (0, row * rowH, w, rowH); | ||||
| rowComp->update (row, owner.isRowSelected (row)); | rowComp->update (row, owner.isRowSelected (row)); | ||||