diff options
author | George Hazan <george.hazan@gmail.com> | 2024-11-21 18:04:05 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-11-21 18:04:05 +0300 |
commit | f3b3e4ccf25f1a6345cb07db6ebdbe2658ba7b27 (patch) | |
tree | 801c6cd0326945baabceecbbbfd81778e0efe54e /plugins/NewStory | |
parent | 562f064fbb05c8d943b4625e988aefc170190252 (diff) |
fixes #4609 (NewStory: скроллбар колбасит)
Diffstat (limited to 'plugins/NewStory')
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index d3ee3d07b1..9887f00e01 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -914,22 +914,29 @@ void NewstoryListData::RecalcScrollBar() if (totalCount == 0)
return;
- int yTotal = 0, yTop = 0, numRec = 0;
+ int yTotal = 0, yTop = 0, yVis = 0, numRec = 0;
for (int i = 0; i < totalCount; i++) {
if (i == scrollTopItem)
yTop = yTotal - scrollTopPixel;
auto *pItem = GetItem(i);
if (pItem->m_bLoaded) {
- yTotal += GetItemHeight(pItem);
numRec++;
+
+ int iHeight = GetItemHeight(pItem);
+ yTotal += iHeight;
+ if (i >= scrollTopItem)
+ yVis += iHeight;
}
}
if (numRec != totalCount) {
double averageH = double(yTotal) / double(numRec);
yTotal = totalCount * averageH;
- yTop = scrollTopItem * averageH;
+ if (cachedMaxDrawnItem == totalCount - 1)
+ yTop = yTotal - ((scrollTopItem == 0) ? yVis : cachedWindowHeight);
+ else
+ yTop = scrollTopItem * averageH;
}
SCROLLINFO si = {};
|