mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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::SetupSwipeHandler(this, _scroll, [=, history = _history](
|
||||||
HistoryView::ChatPaintGestureHorizontalData data) {
|
HistoryView::ChatPaintGestureHorizontalData data) {
|
||||||
const auto changed = (_gestureHorizontal.msgBareId != data.msgBareId)
|
const auto changed = (_gestureHorizontal.msgBareId != data.msgBareId)
|
||||||
|| (_gestureHorizontal.translation != data.translation);
|
|| (_gestureHorizontal.translation != data.translation)
|
||||||
|
|| (_gestureHorizontal.reachRatio != data.reachRatio);
|
||||||
_gestureHorizontal = data;
|
_gestureHorizontal = data;
|
||||||
if (changed) {
|
if (changed) {
|
||||||
const auto item = history->peer->owner().message(
|
const auto item = history->peer->owner().message(
|
||||||
|
|
|
@ -33,6 +33,7 @@ void SetupSwipeHandler(
|
||||||
base::unique_qptr<QObject> filter;
|
base::unique_qptr<QObject> filter;
|
||||||
Ui::Animations::Simple animationReach;
|
Ui::Animations::Simple animationReach;
|
||||||
Ui::Animations::Simple animationEnd;
|
Ui::Animations::Simple animationEnd;
|
||||||
|
ChatPaintGestureHorizontalData data;
|
||||||
SwipeHandlerFinishData finishByTopData;
|
SwipeHandlerFinishData finishByTopData;
|
||||||
std::optional<Qt::Orientation> orientation;
|
std::optional<Qt::Orientation> orientation;
|
||||||
QPointF startAt;
|
QPointF startAt;
|
||||||
|
@ -53,14 +54,12 @@ void SetupSwipeHandler(
|
||||||
}, state->lifetime);
|
}, state->lifetime);
|
||||||
|
|
||||||
const auto updateRatio = [=](float64 ratio) {
|
const auto updateRatio = [=](float64 ratio) {
|
||||||
update({
|
state->data.ratio = std::clamp(ratio, 0., 1.5),
|
||||||
.ratio = std::clamp(ratio, 0., 1.5),
|
state->data.msgBareId = state->finishByTopData.msgBareId;
|
||||||
.reachRatio = state->animationReach.value(0.),
|
state->data.translation = int(
|
||||||
.msgBareId = state->finishByTopData.msgBareId,
|
base::SafeRound(-std::clamp(ratio, 0., 1.5) * threshold));
|
||||||
.translation = int(
|
state->data.cursorTop = state->cursorTop;
|
||||||
base::SafeRound(-std::clamp(ratio, 0., 1.5) * threshold)),
|
update(state->data);
|
||||||
.cursorTop = state->cursorTop,
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
const auto setOrientation = [=](std::optional<Qt::Orientation> o) {
|
const auto setOrientation = [=](std::optional<Qt::Orientation> o) {
|
||||||
state->orientation = o;
|
state->orientation = o;
|
||||||
|
@ -78,7 +77,6 @@ void SetupSwipeHandler(
|
||||||
widget,
|
widget,
|
||||||
state->finishByTopData.callback);
|
state->finishByTopData.callback);
|
||||||
}
|
}
|
||||||
state->animationReach.stop();
|
|
||||||
state->animationEnd.stop();
|
state->animationEnd.stop();
|
||||||
state->animationEnd.start(
|
state->animationEnd.start(
|
||||||
updateRatio,
|
updateRatio,
|
||||||
|
@ -95,8 +93,9 @@ void SetupSwipeHandler(
|
||||||
processEnd();
|
processEnd();
|
||||||
}
|
}
|
||||||
}, state->lifetime);
|
}, state->lifetime);
|
||||||
const auto animationReachCallback = [=] {
|
const auto animationReachCallback = [=](float64 value) {
|
||||||
updateRatio(state->delta.x() / threshold);
|
state->data.reachRatio = value;
|
||||||
|
update(state->data);
|
||||||
};
|
};
|
||||||
struct UpdateArgs {
|
struct UpdateArgs {
|
||||||
QPoint globalCursor;
|
QPoint globalCursor;
|
||||||
|
|
|
@ -883,7 +883,8 @@ void RepliesWidget::setupSwipeReply() {
|
||||||
HistoryView::SetupSwipeHandler(_inner, _scroll.get(), [=](
|
HistoryView::SetupSwipeHandler(_inner, _scroll.get(), [=](
|
||||||
HistoryView::ChatPaintGestureHorizontalData data) {
|
HistoryView::ChatPaintGestureHorizontalData data) {
|
||||||
const auto changed = (_gestureHorizontal.msgBareId != data.msgBareId)
|
const auto changed = (_gestureHorizontal.msgBareId != data.msgBareId)
|
||||||
|| (_gestureHorizontal.translation != data.translation);
|
|| (_gestureHorizontal.translation != data.translation)
|
||||||
|
|| (_gestureHorizontal.reachRatio != data.reachRatio);
|
||||||
_gestureHorizontal = data;
|
_gestureHorizontal = data;
|
||||||
if (changed) {
|
if (changed) {
|
||||||
const auto item = _history->peer->owner().message(
|
const auto item = _history->peer->owner().message(
|
||||||
|
|
Loading…
Add table
Reference in a new issue