This commit is contained in:
blankie 2022-09-14 15:42:48 +03:00 • committed by GitHub
commit 55dab35413
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 10 deletions

View file

@ -640,7 +640,14 @@ HistoryWidget::HistoryWidget(
"sticker_height" "sticker_height"
) | rpl::start_with_next([=] { ) | rpl::start_with_next([=] {
crl::on_main(this, [=] { crl::on_main(this, [=] {
updateHistoryGeometry(); if (_history) {
_history->forceFullResize();
if (_migrated) {
_migrated->forceFullResize();
}
updateHistoryGeometry();
update();
}
}); });
}, lifetime()); }, lifetime());
@ -648,7 +655,14 @@ HistoryWidget::HistoryWidget(
"sticker_scale_both" "sticker_scale_both"
) | rpl::start_with_next([=] { ) | rpl::start_with_next([=] {
crl::on_main(this, [=] { crl::on_main(this, [=] {
updateHistoryGeometry(); if (_history) {
_history->forceFullResize();
if (_migrated) {
_migrated->forceFullResize();
}
updateHistoryGeometry();
update();
}
}); });
}, lifetime()); }, lifetime());

View file

@ -139,7 +139,7 @@ QSize Gif::countThumbSize(int &inOutWidthMax) const {
+ st::msgPadding.right() + st::msgPadding.right()
: 0; : 0;
const auto maxSize = _data->sticker() const auto maxSize = _data->sticker()
? Sticker::Size().width() ? Sticker::Size().height()
: _data->isVideoFile() : _data->isVideoFile()
? st::maxMediaSize ? st::maxMediaSize
: _data->isVideoMessage() : _data->isVideoMessage()

View file

@ -95,17 +95,13 @@ bool Sticker::isEmojiSticker() const {
} }
void Sticker::initSize() { void Sticker::initSize() {
const auto currentStickerHeight = ::Kotato::JsonSettings::GetInt("sticker_height");
const auto currentScaleBoth = ::Kotato::JsonSettings::GetBool("sticker_scale_both");
const auto maxHeight = int(st::maxStickerSize / 256.0 * currentStickerHeight);
const auto maxWidth = currentScaleBoth ? maxHeight : st::maxStickerSize;
if (isEmojiSticker() || _diceIndex >= 0) { if (isEmojiSticker() || _diceIndex >= 0) {
_size = Sticker::EmojiSize(); _size = Sticker::EmojiSize();
if (_diceIndex > 0) { if (_diceIndex > 0) {
[[maybe_unused]] bool result = readyToDrawLottie(); [[maybe_unused]] bool result = readyToDrawLottie();
} }
} else { } else {
_size = DownscaledSize(_data->dimensions, { maxWidth, maxHeight }); _size = DownscaledSize(_data->dimensions, Sticker::Size());
} }
} }
@ -135,8 +131,11 @@ bool Sticker::readyToDrawLottie() {
} }
QSize Sticker::Size() { QSize Sticker::Size() {
const auto side = std::min(st::maxStickerSize, kMaxSizeFixed); const auto currentStickerHeight = ::Kotato::JsonSettings::GetInt("sticker_height");
return { side, side }; const auto currentScaleBoth = ::Kotato::JsonSettings::GetBool("sticker_scale_both");
const auto maxHeight = int(st::maxStickerSize / 256.0 * currentStickerHeight);
const auto maxWidth = currentScaleBoth ? maxHeight : st::maxStickerSize;
return { maxWidth, maxHeight };
} }
QSize Sticker::EmojiSize() { QSize Sticker::EmojiSize() {