diff --git a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp index 45d30a7ed..959d36e51 100644 --- a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp @@ -671,6 +671,8 @@ PeerShortInfoBox::PeerShortInfoBox( ) | rpl::start_with_next([=] { _cover.setScrollTop(_scroll->scrollTop()); }, _cover.lifetime()); + + setCustomCornersFilling(RectPart::FullTop); } PeerShortInfoBox::~PeerShortInfoBox() = default; @@ -795,10 +797,6 @@ void PeerShortInfoBox::prepareRows() { tr::lng_mediaview_copy(tr::now)); } -RectParts PeerShortInfoBox::customCornersFilling() { - return RectPart::FullTop; -} - void PeerShortInfoBox::resizeEvent(QResizeEvent *e) { BoxContent::resizeEvent(e); diff --git a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.h b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.h index b5eec6c19..cda68a99b 100644 --- a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.h +++ b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.h @@ -162,7 +162,6 @@ public: private: void prepare() override; void prepareRows(); - RectParts customCornersFilling() override; void resizeEvent(QResizeEvent *e) override; diff --git a/Telegram/SourceFiles/history/history_view_swipe.cpp b/Telegram/SourceFiles/history/history_view_swipe.cpp index ca479ba75..041664e87 100644 --- a/Telegram/SourceFiles/history/history_view_swipe.cpp +++ b/Telegram/SourceFiles/history/history_view_swipe.cpp @@ -20,6 +20,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include namespace HistoryView { +namespace { + +constexpr auto kSwipeSlow = 0.2; + +} // namespace void SetupSwipeHandler( not_null widget, @@ -63,10 +68,16 @@ void SetupSwipeHandler( }, state->lifetime); const auto updateRatio = [=](float64 ratio) { - state->data.ratio = std::clamp(ratio, 0., kMaxRatio), + ratio = std::max(ratio, 0.); + state->data.ratio = ratio; + const auto overscrollRatio = std::max(ratio - 1., 0.); + const auto translation = int( + base::SafeRound(-std::min(ratio, 1.) * threshold) + ) + Ui::OverscrollFromAccumulated(int( + base::SafeRound(-overscrollRatio * threshold) + )); state->data.msgBareId = state->finishByTopData.msgBareId; - state->data.translation = int( - base::SafeRound(-std::clamp(ratio, 0., kMaxRatio) * threshold)); + state->data.translation = translation; state->data.cursorTop = state->cursorTop; update(state->data); }; @@ -248,10 +259,11 @@ void SetupSwipeHandler( processEnd(); } else { const auto invert = (w->inverted() ? -1 : 1); + const auto delta = Ui::ScrollDeltaF(w) * invert; updateWith({ .globalCursor = w->globalPosition().toPoint(), .position = QPointF(), - .delta = state->delta + Ui::ScrollDelta(w) * invert, + .delta = state->delta + delta * kSwipeSlow, .touch = false, }); } diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 6abc382d7..50d47051e 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -1512,10 +1512,12 @@ void Message::draw(Painter &p, const PaintContext &context) const { + ((g.height() < size * kMaxHeightRatio) ? rightActionSize().value_or(QSize()).width() : 0); + const auto shift = std::min( + (size * kShiftRatio * context.gestureHorizontal.ratio), + -1. * context.gestureHorizontal.translation + ) + (st::historySwipeIconSkip * ratio * (isLeftSize ? .7 : 1.)); const auto rect = QRectF( - outerWidth - - (size * kShiftRatio * context.gestureHorizontal.ratio) - - (st::historySwipeIconSkip * ratio * (isLeftSize ? .7 : 1.)), + outerWidth - shift, g.y() + (g.height() - size) / 2, size, size); diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 9965046aa..9ca74272a 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 9965046aac159fab07bbe99d27692d76d1b86312 +Subproject commit 9ca74272a0ec33bac83c5b61a73d523902eb96cd