Handle repost info clicks in expanded mode.
This commit is contained in:
parent
5aaf119b36
commit
6057bb2b37
3 changed files with 39 additions and 0 deletions
|
@ -68,6 +68,37 @@ CaptionFullView::CaptionFullView(not_null<Controller*> controller)
|
|||
return base::EventFilterResult::Continue;
|
||||
};
|
||||
base::install_event_filter(_text.get(), filter);
|
||||
if (_controller->repost()) {
|
||||
_wrap->setMouseTracking(true);
|
||||
base::install_event_filter(_wrap.get(), [=](not_null<QEvent*> e) {
|
||||
const auto mouse = [&] {
|
||||
return static_cast<QMouseEvent*>(e.get());
|
||||
};
|
||||
const auto type = e->type();
|
||||
if (type == QEvent::MouseMove) {
|
||||
const auto handler = _controller->lookupRepostHandler(
|
||||
mouse()->pos() - QPoint(
|
||||
st::mediaviewCaptionPadding.left(),
|
||||
(_wrap->padding().top()
|
||||
- _controller->repostCaptionPadding().top())));
|
||||
ClickHandler::setActive(handler.link, handler.host);
|
||||
_wrap->setCursor(handler.link
|
||||
? style::cur_pointer
|
||||
: style::cur_default);
|
||||
} else if (type == QEvent::MouseButtonPress
|
||||
&& mouse()->button() == Qt::LeftButton
|
||||
&& ClickHandler::getActive()) {
|
||||
ClickHandler::pressed();
|
||||
} else if (type == QEvent::MouseButtonRelease) {
|
||||
if (const auto activated = ClickHandler::unpressed()) {
|
||||
ActivateClickHandler(_wrap.get(), activated, {
|
||||
mouse()->button(),
|
||||
});
|
||||
}
|
||||
}
|
||||
return base::EventFilterResult::Continue;
|
||||
});
|
||||
}
|
||||
base::install_event_filter(_wrap.get(), filter);
|
||||
|
||||
using Type = Ui::ElasticScroll::OverscrollType;
|
||||
|
@ -139,6 +170,10 @@ void CaptionFullView::close() {
|
|||
startAnimation();
|
||||
}
|
||||
|
||||
void CaptionFullView::repaint() {
|
||||
_wrap->update();
|
||||
}
|
||||
|
||||
void CaptionFullView::updateGeometry() {
|
||||
if (_outer.isEmpty()) {
|
||||
return;
|
||||
|
|
|
@ -30,6 +30,7 @@ public:
|
|||
~CaptionFullView();
|
||||
|
||||
void close();
|
||||
void repaint();
|
||||
[[nodiscard]] bool closing() const;
|
||||
[[nodiscard]] bool focused() const;
|
||||
|
||||
|
|
|
@ -1378,6 +1378,9 @@ void Controller::repaintSibling(not_null<Sibling*> sibling) {
|
|||
}
|
||||
|
||||
void Controller::repaint() {
|
||||
if (_captionFullView) {
|
||||
_captionFullView->repaint();
|
||||
}
|
||||
_delegate->storiesRepaint();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue