mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-05-29 19:23:58 +02:00
Added ability to request reach out ratio of swipe.
This commit is contained in:
parent
f3ea24f9f9
commit
ad9106b815
2 changed files with 10 additions and 0 deletions
|
@ -213,6 +213,7 @@ void SetupSwipeHandler(
|
||||||
if (!state->started || state->touch != args.touch) {
|
if (!state->started || state->touch != args.touch) {
|
||||||
LOG(("STARTING"));
|
LOG(("STARTING"));
|
||||||
state->started = true;
|
state->started = true;
|
||||||
|
state->data.reachRatio = 0.;
|
||||||
state->touch = args.touch;
|
state->touch = args.touch;
|
||||||
state->startAt = args.position;
|
state->startAt = args.position;
|
||||||
state->cursorTop = widget->mapFromGlobal(args.globalCursor).y();
|
state->cursorTop = widget->mapFromGlobal(args.globalCursor).y();
|
||||||
|
@ -265,6 +266,14 @@ void SetupSwipeHandler(
|
||||||
base::Platform::Haptic();
|
base::Platform::Haptic();
|
||||||
} else if (state->reached
|
} else if (state->reached
|
||||||
&& ratio < kResetReachedOn) {
|
&& ratio < kResetReachedOn) {
|
||||||
|
if (state->finishByTopData.provideReachOutRatio) {
|
||||||
|
state->animationReach.stop();
|
||||||
|
state->animationReach.start(
|
||||||
|
animationReachCallback,
|
||||||
|
1.,
|
||||||
|
0.,
|
||||||
|
kBounceDuration);
|
||||||
|
}
|
||||||
state->reached = false;
|
state->reached = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ struct SwipeHandlerFinishData {
|
||||||
int64 msgBareId = 0;
|
int64 msgBareId = 0;
|
||||||
float64 speedRatio = 1.0;
|
float64 speedRatio = 1.0;
|
||||||
bool keepRatioWithinRange = false;
|
bool keepRatioWithinRange = false;
|
||||||
|
bool provideReachOutRatio = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
using Scroll = std::variant<
|
using Scroll = std::variant<
|
||||||
|
|
Loading…
Add table
Reference in a new issue