Fix empty space to the right of photo media.

This commit is contained in:
John Preston 2024-06-06 21:43:31 +04:00
parent d5d9da7d0a
commit 14909ae913
4 changed files with 13 additions and 0 deletions

View File

@ -113,6 +113,10 @@ void ExtendedPreview::unloadHeavyPart() {
_spoiler.animation = nullptr;
}
bool ExtendedPreview::enforceBubbleWidth() const {
return true;
}
QSize ExtendedPreview::countOptimalSize() {
const auto &preview = _invoice->extendedPreview;
const auto dimensions = preview.dimensions;

View File

@ -54,6 +54,7 @@ public:
bool hasHeavyPart() const override;
void unloadHeavyPart() override;
bool enforceBubbleWidth() const override;
private:
int minWidthForButton() const;

View File

@ -162,6 +162,10 @@ void Photo::unloadHeavyPart() {
togglePollingStory(false);
}
bool Photo::enforceBubbleWidth() const {
return true;
}
void Photo::togglePollingStory(bool enabled) const {
const auto pollingStory = (enabled ? 1 : 0);
if (!_storyId || _pollingStory == pollingStory) {
@ -193,6 +197,9 @@ QSize Photo::countOptimalSize() {
auto maxWidth = qMax(maxActualWidth, scaled.height());
auto minHeight = qMax(scaled.height(), st::minPhotoSize);
if (_parent->hasBubble()) {
const auto captionMaxWidth = _parent->textualMaxWidth();
const auto maxWithCaption = qMin(st::msgMaxWidth, captionMaxWidth);
maxWidth = qMin(qMax(maxWidth, maxWithCaption), st::msgMaxWidth);
minHeight = adjustHeightForLessCrop(
dimensions,
{ maxWidth, minHeight });

View File

@ -88,6 +88,7 @@ public:
bool hasHeavyPart() const override;
void unloadHeavyPart() override;
bool enforceBubbleWidth() const override;
protected:
float64 dataProgress() const override;