mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2025-07-01 15:26:11 +00:00
Improve smooth scrolling precision
This commit is contained in:
parent
855f48b455
commit
7df349ad7c
@ -704,20 +704,21 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
|||||||
}
|
}
|
||||||
|
|
||||||
CGPoint currentScrollTranslation = [gesture translationInView:self];
|
CGPoint currentScrollTranslation = [gesture translationInView:self];
|
||||||
|
const short translationMultiplier = 120 * 20; // WHEEL_DELTA * 20
|
||||||
|
|
||||||
{
|
{
|
||||||
short translationDeltaY = ((currentScrollTranslation.y - lastScrollTranslation.y) / self.bounds.size.height) * 120; // WHEEL_DELTA
|
short translationDeltaY = ((currentScrollTranslation.y - lastScrollTranslation.y) / self.bounds.size.height) * translationMultiplier;
|
||||||
if (translationDeltaY != 0) {
|
if (translationDeltaY != 0) {
|
||||||
LiSendHighResScrollEvent(translationDeltaY * 20);
|
LiSendHighResScrollEvent(translationDeltaY);
|
||||||
lastScrollTranslation = currentScrollTranslation;
|
lastScrollTranslation = currentScrollTranslation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
short translationDeltaX = ((currentScrollTranslation.x - lastScrollTranslation.x) / self.bounds.size.width) * 120; // WHEEL_DELTA
|
short translationDeltaX = ((currentScrollTranslation.x - lastScrollTranslation.x) / self.bounds.size.width) * translationMultiplier;
|
||||||
if (translationDeltaX != 0) {
|
if (translationDeltaX != 0) {
|
||||||
// Direction is reversed from vertical scrolling
|
// Direction is reversed from vertical scrolling
|
||||||
LiSendHighResHScrollEvent(-translationDeltaX * 20);
|
LiSendHighResHScrollEvent(-translationDeltaX);
|
||||||
lastScrollTranslation = currentScrollTranslation;
|
lastScrollTranslation = currentScrollTranslation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user