Fix scrollbars on Menu/MessageBox

This commit is contained in:
2024-10-05 17:37:45 +02:00
parent be55b07b38
commit 0a82eb7a3c
3 changed files with 77 additions and 13 deletions

View File

@ -80,11 +80,16 @@ class MessageBox
$visibleItems = $height - 4;
// calculate scrollbar thumb positions
$scrollTop = ($this->scroll / ($maxScroll + $visibleItems));
$scrollVisible = $visibleItems / count($wrapped); // / $visibleItems;
$scrollBottom = $scrollTop + $scrollVisible;
$thumbTop = round($scrollTop * $visibleItems);
$thumbBottom = round($visibleItems * $scrollBottom);
// $scrollTop = ($this->scroll / ($maxScroll + $visibleItems));
// $scrollVisible = $visibleItems / count($wrapped); // / $visibleItems;
// $scrollBottom = $scrollTop + $scrollVisible;
// $thumbTop = round($scrollTop * $visibleItems);
// $thumbBottom = round($visibleItems * $scrollBottom);
$scrollTop = $this->scroll;
$scrollBottom = $scrollTop + $visibleItems - 1;
$thumbTop = round(($visibleItems - 1) / count($wrapped) * $scrollTop);
$thumbBottom = round(($visibleItems - 1) / count($wrapped) * $scrollBottom);
echo "\e[40;37m";
$this->terminal