2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Replaced snap util function with std::clamp.

This commit is contained in:
23rd
2021-01-23 06:29:50 +03:00
parent 4895e5e110
commit dd01ece14a
44 changed files with 193 additions and 92 deletions

View File

@@ -87,7 +87,10 @@ void Widget::moveBottom(int bottom) {
void Widget::updateContentHeight() {
auto addedHeight = innerPadding().top() + innerPadding().bottom();
auto wantedContentHeight = qRound(st::emojiPanHeightRatio * _bottom) - addedHeight;
auto contentHeight = snap(wantedContentHeight, st::inlineResultsMinHeight, st::inlineResultsMaxHeight);
auto contentHeight = std::clamp(
wantedContentHeight,
st::inlineResultsMinHeight,
st::inlineResultsMaxHeight);
accumulate_min(contentHeight, _bottom - addedHeight);
accumulate_min(contentHeight, _contentMaxHeight);
auto resultTop = _bottom - addedHeight - contentHeight;