mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fixed updating of message on bounce animation of swipe-on-reply icon.
This commit is contained in:
parent
c589ee1ca5
commit
96b7755cde
3 changed files with 14 additions and 13 deletions
|
@ -582,7 +582,8 @@ void HistoryInner::setupSwipeReply() {
|
|||
HistoryView::SetupSwipeHandler(this, _scroll, [=, history = _history](
|
||||
HistoryView::ChatPaintGestureHorizontalData data) {
|
||||
const auto changed = (_gestureHorizontal.msgBareId != data.msgBareId)
|
||||
|| (_gestureHorizontal.translation != data.translation);
|
||||
|| (_gestureHorizontal.translation != data.translation)
|
||||
|| (_gestureHorizontal.reachRatio != data.reachRatio);
|
||||
_gestureHorizontal = data;
|
||||
if (changed) {
|
||||
const auto item = history->peer->owner().message(
|
||||
|
|
|
@ -33,6 +33,7 @@ void SetupSwipeHandler(
|
|||
base::unique_qptr<QObject> filter;
|
||||
Ui::Animations::Simple animationReach;
|
||||
Ui::Animations::Simple animationEnd;
|
||||
ChatPaintGestureHorizontalData data;
|
||||
SwipeHandlerFinishData finishByTopData;
|
||||
std::optional<Qt::Orientation> orientation;
|
||||
QPointF startAt;
|
||||
|
@ -53,14 +54,12 @@ void SetupSwipeHandler(
|
|||
}, state->lifetime);
|
||||
|
||||
const auto updateRatio = [=](float64 ratio) {
|
||||
update({
|
||||
.ratio = std::clamp(ratio, 0., 1.5),
|
||||
.reachRatio = state->animationReach.value(0.),
|
||||
.msgBareId = state->finishByTopData.msgBareId,
|
||||
.translation = int(
|
||||
base::SafeRound(-std::clamp(ratio, 0., 1.5) * threshold)),
|
||||
.cursorTop = state->cursorTop,
|
||||
});
|
||||
state->data.ratio = std::clamp(ratio, 0., 1.5),
|
||||
state->data.msgBareId = state->finishByTopData.msgBareId;
|
||||
state->data.translation = int(
|
||||
base::SafeRound(-std::clamp(ratio, 0., 1.5) * threshold));
|
||||
state->data.cursorTop = state->cursorTop;
|
||||
update(state->data);
|
||||
};
|
||||
const auto setOrientation = [=](std::optional<Qt::Orientation> o) {
|
||||
state->orientation = o;
|
||||
|
@ -78,7 +77,6 @@ void SetupSwipeHandler(
|
|||
widget,
|
||||
state->finishByTopData.callback);
|
||||
}
|
||||
state->animationReach.stop();
|
||||
state->animationEnd.stop();
|
||||
state->animationEnd.start(
|
||||
updateRatio,
|
||||
|
@ -95,8 +93,9 @@ void SetupSwipeHandler(
|
|||
processEnd();
|
||||
}
|
||||
}, state->lifetime);
|
||||
const auto animationReachCallback = [=] {
|
||||
updateRatio(state->delta.x() / threshold);
|
||||
const auto animationReachCallback = [=](float64 value) {
|
||||
state->data.reachRatio = value;
|
||||
update(state->data);
|
||||
};
|
||||
struct UpdateArgs {
|
||||
QPoint globalCursor;
|
||||
|
|
|
@ -883,7 +883,8 @@ void RepliesWidget::setupSwipeReply() {
|
|||
HistoryView::SetupSwipeHandler(_inner, _scroll.get(), [=](
|
||||
HistoryView::ChatPaintGestureHorizontalData data) {
|
||||
const auto changed = (_gestureHorizontal.msgBareId != data.msgBareId)
|
||||
|| (_gestureHorizontal.translation != data.translation);
|
||||
|| (_gestureHorizontal.translation != data.translation)
|
||||
|| (_gestureHorizontal.reachRatio != data.reachRatio);
|
||||
_gestureHorizontal = data;
|
||||
if (changed) {
|
||||
const auto item = _history->peer->owner().message(
|
||||
|
|
Loading…
Add table
Reference in a new issue