Show expand/collapse icon in factcheck.
This commit is contained in:
parent
a87a221f26
commit
74861a334d
4 changed files with 22 additions and 4 deletions
|
@ -598,6 +598,7 @@ QSize WebPage::countCurrentSize(int newWidth) {
|
|||
: FactcheckMetrics();
|
||||
if (factcheck) {
|
||||
factcheck->expandable = factcheckMetrics.expandable;
|
||||
factcheck->expanded = factcheckMetrics.expanded;
|
||||
_openl = factcheck->expandable
|
||||
? ToggleFactcheckClickHandler(_parent)
|
||||
: nullptr;
|
||||
|
@ -779,11 +780,12 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
|
|||
auto paintw = inner.width();
|
||||
|
||||
const auto sponsored = sponsoredData();
|
||||
const auto factcheck = factcheckData();
|
||||
|
||||
const auto selected = context.selected();
|
||||
const auto view = parent();
|
||||
const auto from = view->data()->contentColorsFrom();
|
||||
const auto colorIndex = factcheckData()
|
||||
const auto colorIndex = factcheck
|
||||
? 0 // red
|
||||
: (sponsored && sponsored->colorIndex)
|
||||
? sponsored->colorIndex
|
||||
|
@ -793,8 +795,9 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
|
|||
const auto cache = context.outbg
|
||||
? stm->replyCache[st->colorPatternIndex(colorIndex)].get()
|
||||
: st->coloredReplyCache(selected, colorIndex).get();
|
||||
const auto backgroundEmojiId = (sponsored
|
||||
&& sponsored->backgroundEmojiId)
|
||||
const auto backgroundEmojiId = factcheck
|
||||
? DocumentId()
|
||||
: (sponsored && sponsored->backgroundEmojiId)
|
||||
? sponsored->backgroundEmojiId
|
||||
: from
|
||||
? from->backgroundEmojiId()
|
||||
|
@ -821,6 +824,15 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
|
|||
if (!backgroundEmojiCache->frames[0].isNull()) {
|
||||
FillBackgroundEmoji(p, outer, false, *backgroundEmojiCache);
|
||||
}
|
||||
} else if (factcheck && factcheck->expandable) {
|
||||
const auto &icon = factcheck->expanded
|
||||
? st::factcheckIconCollapse
|
||||
: st::factcheckIconExpand;
|
||||
icon.paint(
|
||||
p,
|
||||
outer.x() + outer.width() - icon.width() - _st.padding.right(),
|
||||
outer.y() + _st.padding.top(),
|
||||
width());
|
||||
}
|
||||
|
||||
if (_ripple) {
|
||||
|
@ -1487,6 +1499,7 @@ WebPage::FactcheckMetrics WebPage::computeFactcheckMetrics(
|
|||
return {
|
||||
.lines = allowExpanding ? possible : kFactcheckCollapsedLines,
|
||||
.expandable = expandable,
|
||||
.expanded = expanded,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ private:
|
|||
struct FactcheckMetrics {
|
||||
int lines = 0;
|
||||
bool expandable = false;
|
||||
bool expanded = false;
|
||||
};
|
||||
struct HintData {
|
||||
QSize size;
|
||||
|
@ -129,6 +130,7 @@ private:
|
|||
struct FactcheckData {
|
||||
HintData hint;
|
||||
bool expandable = false;
|
||||
bool expanded = false;
|
||||
};
|
||||
using AdditionalData = std::variant<
|
||||
StickerSetData,
|
||||
|
|
|
@ -1132,3 +1132,6 @@ effectPreviewPromoPadding: margins(4px, 6px, 4px, 6px);
|
|||
effectPreviewLoading: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) {
|
||||
thickness: 2px;
|
||||
}
|
||||
|
||||
factcheckIconExpand: icon {{ "fast_to_original-rotate_cw", historyPeer1NameFg }};
|
||||
factcheckIconCollapse: icon {{ "fast_to_original-rotate_ccw", historyPeer1NameFg }};
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6462cda46ec5d48a9ae452ba1b6f7dfe1b6d882d
|
||||
Subproject commit 0af136124083369073b8fdaf45f0816fd2b10bad
|
Loading…
Reference in a new issue