Skip to content
Snippets Groups Projects
Commit 320bd365 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Merge branch 'dd_lightbar_menu_UpdateScrollbar_RowOutOfRange_Fix' into 'master'

dd_lightbar_menu.js: Fix for out-of-bounds row updates when updating the scrollbar in DDLightbarMenu_UpdateScrollbar()

See merge request !457
parents 9813db14 806593ac
No related branches found
No related tags found
1 merge request!457dd_lightbar_menu.js: Fix for out-of-bounds row updates when updating the scrollbar in DDLightbarMenu_UpdateScrollbar()
......@@ -3134,8 +3134,19 @@ function DDLightbarMenu_UpdateScrollbar(pNewStartRow, pOldStartRow, pNumSolidBlo
// then the solid block section has moved down; if the diff is negative, the
// solid block section has moved up.
var solidBlockStartRowDiff = pNewStartRow - pOldStartRow;
// Calculate the 'old' last row & new last row, but don't let them go over
// the bottom row of the menu
var oldLastRow = pOldStartRow + numSolidBlocks - 1;
const maxY = this.pos.y + this.size.height - 1;
if (oldLastRow > maxY)
oldLastRow = maxY;
else if (oldLastRow < this.pos.y)
oldLastRow = this.pos.y;
var newLastRow = pNewStartRow + numSolidBlocks - 1;
if (newLastRow > maxY)
newLastRow = maxY;
else if (newLastRow < this.pos.y)
newLastRow = this.pos.y;
if (solidBlockStartRowDiff > 0)
{
// The solid block section has moved down
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment