mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix webpage preview glitch.
This commit is contained in:
parent
17cdc2b585
commit
5e2eda6af3
1 changed files with 12 additions and 3 deletions
|
@ -50,6 +50,7 @@ constexpr auto kMaxOriginalEntryLines = 8192;
|
||||||
constexpr auto kFactcheckCollapsedLines = 3;
|
constexpr auto kFactcheckCollapsedLines = 3;
|
||||||
constexpr auto kStickerSetLines = 3;
|
constexpr auto kStickerSetLines = 3;
|
||||||
constexpr auto kFactcheckAboutDuration = 5 * crl::time(1000);
|
constexpr auto kFactcheckAboutDuration = 5 * crl::time(1000);
|
||||||
|
constexpr auto kSponsoredUserpicLines = 2;
|
||||||
|
|
||||||
[[nodiscard]] int ArticleThumbWidth(not_null<PhotoData*> thumb, int height) {
|
[[nodiscard]] int ArticleThumbWidth(not_null<PhotoData*> thumb, int height) {
|
||||||
const auto size = thumb->location(Data::PhotoSize::Thumbnail);
|
const auto size = thumb->location(Data::PhotoSize::Thumbnail);
|
||||||
|
@ -375,6 +376,9 @@ QSize WebPage::countOptimalSize() {
|
||||||
|
|
||||||
const auto sponsored = sponsoredData();
|
const auto sponsored = sponsoredData();
|
||||||
const auto factcheck = factcheckData();
|
const auto factcheck = factcheckData();
|
||||||
|
const auto stickerSet = stickerSetData();
|
||||||
|
const auto specialRightPix = (stickerSet
|
||||||
|
|| (sponsored && !sponsored->hasMedia && _data->photo));
|
||||||
|
|
||||||
// Detect _openButtonWidth before counting paddings.
|
// Detect _openButtonWidth before counting paddings.
|
||||||
_openButton = Ui::Text::String();
|
_openButton = Ui::Text::String();
|
||||||
|
@ -600,10 +604,16 @@ QSize WebPage::countOptimalSize() {
|
||||||
+ titleMinHeight
|
+ titleMinHeight
|
||||||
+ descriptionMinHeight;
|
+ descriptionMinHeight;
|
||||||
const auto articlePhotoMaxWidth = _asArticle
|
const auto articlePhotoMaxWidth = _asArticle
|
||||||
? st::webPagePhotoDelta
|
? (st::webPagePhotoDelta
|
||||||
+ std::max(
|
+ std::max(
|
||||||
ArticleThumbWidth(_data->photo, articleMinHeight),
|
ArticleThumbWidth(_data->photo, articleMinHeight),
|
||||||
lineHeight)
|
lineHeight))
|
||||||
|
: specialRightPix
|
||||||
|
? (st::webPagePhotoDelta
|
||||||
|
+ (lineHeight
|
||||||
|
* (stickerSet
|
||||||
|
? kStickerSetLines
|
||||||
|
: kSponsoredUserpicLines)))
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
if (!_siteName.isEmpty()) {
|
if (!_siteName.isEmpty()) {
|
||||||
|
@ -705,7 +715,6 @@ QSize WebPage::countCurrentSize(int newWidth) {
|
||||||
const auto twoTitleLines = 2 * st::webPageTitleFont->height;
|
const auto twoTitleLines = 2 * st::webPageTitleFont->height;
|
||||||
const auto descriptionLineHeight = st::webPageDescriptionFont->height;
|
const auto descriptionLineHeight = st::webPageDescriptionFont->height;
|
||||||
if (asArticle() || specialRightPix) {
|
if (asArticle() || specialRightPix) {
|
||||||
constexpr auto kSponsoredUserpicLines = 2;
|
|
||||||
_pixh = lineHeight
|
_pixh = lineHeight
|
||||||
* (stickerSet
|
* (stickerSet
|
||||||
? kStickerSetLines
|
? kStickerSetLines
|
||||||
|
|
Loading…
Add table
Reference in a new issue