mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
Fix _height value in inline bot result Gif layout.
This fixes render glitches in GIFs column with opened MediaView.
This commit is contained in:
parent
977dee3599
commit
16ca2d39c5
3 changed files with 14 additions and 17 deletions
|
@ -596,12 +596,13 @@ void GifsListWidget::layoutInlineRow(Row &row, int fullWidth) {
|
|||
row.height = 0;
|
||||
int availw = fullWidth - (st::inlineResultsLeft - st::buttonRadius);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
int index = indices[i];
|
||||
int w = desiredWidth
|
||||
? (row.items[index]->maxWidth() * availw / desiredWidth)
|
||||
: row.items[index]->maxWidth();
|
||||
int actualw = qMax(w, int(st::inlineResultsMinWidth));
|
||||
row.height = qMax(row.height, row.items[index]->resizeGetHeight(actualw));
|
||||
const auto index = indices[i];
|
||||
const auto &item = row.items[index];
|
||||
const auto w = desiredWidth
|
||||
? (item->maxWidth() * availw / desiredWidth)
|
||||
: item->maxWidth();
|
||||
auto actualw = qMax(w, st::inlineResultsMinWidth);
|
||||
row.height = qMax(row.height, item->resizeGetHeight(actualw));
|
||||
if (desiredWidth) {
|
||||
availw -= actualw;
|
||||
desiredWidth -= row.items[index]->maxWidth();
|
||||
|
|
|
@ -134,6 +134,12 @@ void DeleteSavedGifClickHandler::onClickImpl() const {
|
|||
Auth().data().markSavedGifsUpdated();
|
||||
}
|
||||
|
||||
int Gif::resizeGetHeight(int width) {
|
||||
_width = width;
|
||||
_height = _minh;
|
||||
return _height;
|
||||
}
|
||||
|
||||
void Gif::paint(Painter &p, const QRect &clip, const PaintContext *context) const {
|
||||
DocumentData *document = getShownDocument();
|
||||
document->automaticLoad(nullptr);
|
||||
|
@ -921,12 +927,6 @@ void Contact::initDimensions() {
|
|||
_minh += st::inlineRowMargin * 2 + st::inlineRowBorder;
|
||||
}
|
||||
|
||||
int32 Contact::resizeGetHeight(int32 width) {
|
||||
_width = qMin(width, _maxw);
|
||||
_height = _minh;
|
||||
return _height;
|
||||
}
|
||||
|
||||
void Contact::paint(Painter &p, const QRect &clip, const PaintContext *context) const {
|
||||
int32 left = st::emojiPanHeaderLeft - st::inlineResultsLeft;
|
||||
|
||||
|
|
|
@ -80,10 +80,7 @@ public:
|
|||
// ClickHandlerHost interface
|
||||
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override;
|
||||
|
||||
int resizeGetHeight(int width) override {
|
||||
_width = width;
|
||||
return _minh;
|
||||
}
|
||||
int resizeGetHeight(int width) override;
|
||||
|
||||
private:
|
||||
QSize countFrameSize() const;
|
||||
|
@ -306,7 +303,6 @@ public:
|
|||
Contact(not_null<Context*> context, Result *result);
|
||||
|
||||
void initDimensions() override;
|
||||
int resizeGetHeight(int width) override;
|
||||
|
||||
void paint(Painter &p, const QRect &clip, const PaintContext *context) const override;
|
||||
HistoryTextState getState(
|
||||
|
|
Loading…
Add table
Reference in a new issue