mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-08 08:04:08 +02:00
Click on root pinned bar throws to replies start.
This commit is contained in:
parent
e484bc78d0
commit
27f85df562
2 changed files with 25 additions and 1 deletions
|
@ -270,7 +270,7 @@ void RepliesWidget::setupRootView() {
|
||||||
raw->resize(raw->width(), st::historyReplyHeight);
|
raw->resize(raw->width(), st::historyReplyHeight);
|
||||||
raw->paintRequest(
|
raw->paintRequest(
|
||||||
) | rpl::start_with_next([=](QRect clip) {
|
) | rpl::start_with_next([=](QRect clip) {
|
||||||
auto p = Painter(_rootView->entity());
|
auto p = Painter(raw);
|
||||||
p.fillRect(clip, st::historyPinnedBg);
|
p.fillRect(clip, st::historyPinnedBg);
|
||||||
|
|
||||||
auto top = st::msgReplyPadding.top();
|
auto top = st::msgReplyPadding.top();
|
||||||
|
@ -308,6 +308,25 @@ void RepliesWidget::setupRootView() {
|
||||||
}
|
}
|
||||||
}, raw->lifetime());
|
}, raw->lifetime());
|
||||||
|
|
||||||
|
raw->setCursor(style::cur_pointer);
|
||||||
|
const auto pressed = raw->lifetime().make_state<bool>();
|
||||||
|
raw->events(
|
||||||
|
) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||||
|
const auto mouse = static_cast<QMouseEvent*>(e.get());
|
||||||
|
if (e->type() == QEvent::MouseButtonPress) {
|
||||||
|
if (mouse->button() == Qt::LeftButton) {
|
||||||
|
*pressed = true;
|
||||||
|
}
|
||||||
|
} else if (e->type() == QEvent::MouseButtonRelease) {
|
||||||
|
if (mouse->button() == Qt::LeftButton) {
|
||||||
|
if (base::take(*pressed)
|
||||||
|
&& raw->rect().contains(mouse->pos())) {
|
||||||
|
showAtStart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, raw->lifetime());
|
||||||
|
|
||||||
_rootView->geometryValue(
|
_rootView->geometryValue(
|
||||||
) | rpl::start_with_next([=](QRect rect) {
|
) | rpl::start_with_next([=](QRect rect) {
|
||||||
_rootShadow->moveToLeft(
|
_rootShadow->moveToLeft(
|
||||||
|
@ -1068,6 +1087,10 @@ void RepliesWidget::scrollDownClicked() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RepliesWidget::showAtStart() {
|
||||||
|
showAtPosition(Data::MinMessagePosition);
|
||||||
|
}
|
||||||
|
|
||||||
void RepliesWidget::showAtEnd() {
|
void RepliesWidget::showAtEnd() {
|
||||||
showAtPosition(Data::MaxMessagePosition);
|
showAtPosition(Data::MaxMessagePosition);
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,6 +141,7 @@ private:
|
||||||
void updateAdaptiveLayout();
|
void updateAdaptiveLayout();
|
||||||
void saveState(not_null<RepliesMemento*> memento);
|
void saveState(not_null<RepliesMemento*> memento);
|
||||||
void restoreState(not_null<RepliesMemento*> memento);
|
void restoreState(not_null<RepliesMemento*> memento);
|
||||||
|
void showAtStart();
|
||||||
void showAtEnd();
|
void showAtEnd();
|
||||||
void showAtPosition(
|
void showAtPosition(
|
||||||
Data::MessagePosition position,
|
Data::MessagePosition position,
|
||||||
|
|
Loading…
Add table
Reference in a new issue