mirror of https://github.com/procxx/kepka.git
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
|
@ -596,12 +596,13 @@ void GifsListWidget::layoutInlineRow(Row &row, int fullWidth) {
|
||||||
row.height = 0;
|
row.height = 0;
|
||||||
int availw = fullWidth - (st::inlineResultsLeft - st::buttonRadius);
|
int availw = fullWidth - (st::inlineResultsLeft - st::buttonRadius);
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
int index = indices[i];
|
const auto index = indices[i];
|
||||||
int w = desiredWidth
|
const auto &item = row.items[index];
|
||||||
? (row.items[index]->maxWidth() * availw / desiredWidth)
|
const auto w = desiredWidth
|
||||||
: row.items[index]->maxWidth();
|
? (item->maxWidth() * availw / desiredWidth)
|
||||||
int actualw = qMax(w, int(st::inlineResultsMinWidth));
|
: item->maxWidth();
|
||||||
row.height = qMax(row.height, row.items[index]->resizeGetHeight(actualw));
|
auto actualw = qMax(w, st::inlineResultsMinWidth);
|
||||||
|
row.height = qMax(row.height, item->resizeGetHeight(actualw));
|
||||||
if (desiredWidth) {
|
if (desiredWidth) {
|
||||||
availw -= actualw;
|
availw -= actualw;
|
||||||
desiredWidth -= row.items[index]->maxWidth();
|
desiredWidth -= row.items[index]->maxWidth();
|
||||||
|
|
|
@ -134,6 +134,12 @@ void DeleteSavedGifClickHandler::onClickImpl() const {
|
||||||
Auth().data().markSavedGifsUpdated();
|
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 {
|
void Gif::paint(Painter &p, const QRect &clip, const PaintContext *context) const {
|
||||||
DocumentData *document = getShownDocument();
|
DocumentData *document = getShownDocument();
|
||||||
document->automaticLoad(nullptr);
|
document->automaticLoad(nullptr);
|
||||||
|
@ -921,12 +927,6 @@ void Contact::initDimensions() {
|
||||||
_minh += st::inlineRowMargin * 2 + st::inlineRowBorder;
|
_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 {
|
void Contact::paint(Painter &p, const QRect &clip, const PaintContext *context) const {
|
||||||
int32 left = st::emojiPanHeaderLeft - st::inlineResultsLeft;
|
int32 left = st::emojiPanHeaderLeft - st::inlineResultsLeft;
|
||||||
|
|
||||||
|
|
|
@ -80,10 +80,7 @@ public:
|
||||||
// ClickHandlerHost interface
|
// ClickHandlerHost interface
|
||||||
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override;
|
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override;
|
||||||
|
|
||||||
int resizeGetHeight(int width) override {
|
int resizeGetHeight(int width) override;
|
||||||
_width = width;
|
|
||||||
return _minh;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSize countFrameSize() const;
|
QSize countFrameSize() const;
|
||||||
|
@ -306,7 +303,6 @@ public:
|
||||||
Contact(not_null<Context*> context, Result *result);
|
Contact(not_null<Context*> context, Result *result);
|
||||||
|
|
||||||
void initDimensions() override;
|
void initDimensions() override;
|
||||||
int resizeGetHeight(int width) override;
|
|
||||||
|
|
||||||
void paint(Painter &p, const QRect &clip, const PaintContext *context) const override;
|
void paint(Painter &p, const QRect &clip, const PaintContext *context) const override;
|
||||||
HistoryTextState getState(
|
HistoryTextState getState(
|
||||||
|
|
Loading…
Reference in New Issue