mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-17 14:11:35 +00:00
Implement horizontal scrolling
This commit is contained in:
@@ -474,11 +474,23 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
|||||||
}
|
}
|
||||||
|
|
||||||
CGPoint currentScrollTranslation = [gesture translationInView:self];
|
CGPoint currentScrollTranslation = [gesture translationInView:self];
|
||||||
|
|
||||||
|
{
|
||||||
short translationDeltaY = ((currentScrollTranslation.y - lastScrollTranslation.y) / self.bounds.size.height) * 120; // WHEEL_DELTA
|
short translationDeltaY = ((currentScrollTranslation.y - lastScrollTranslation.y) / self.bounds.size.height) * 120; // WHEEL_DELTA
|
||||||
if (translationDeltaY != 0) {
|
if (translationDeltaY != 0) {
|
||||||
LiSendHighResScrollEvent(translationDeltaY * 20);
|
LiSendHighResScrollEvent(translationDeltaY * 20);
|
||||||
lastScrollTranslation = currentScrollTranslation;
|
lastScrollTranslation = currentScrollTranslation;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
short translationDeltaX = ((currentScrollTranslation.x - lastScrollTranslation.x) / self.bounds.size.width) * 120; // WHEEL_DELTA
|
||||||
|
if (translationDeltaX != 0) {
|
||||||
|
// Direction is reversed from vertical scrolling
|
||||||
|
LiSendHighResHScrollEvent(-translationDeltaX * 20);
|
||||||
|
lastScrollTranslation = currentScrollTranslation;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseWheelMovedDiscrete:(UIPanGestureRecognizer *)gesture {
|
- (void)mouseWheelMovedDiscrete:(UIPanGestureRecognizer *)gesture {
|
||||||
@@ -497,10 +509,21 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
|||||||
// Using velocityInView is 0 for discrete scroll events
|
// Using velocityInView is 0 for discrete scroll events
|
||||||
// when scrolling very slowly, but translationInView does work.
|
// when scrolling very slowly, but translationInView does work.
|
||||||
CGPoint currentScrollTranslation = [gesture translationInView:self];
|
CGPoint currentScrollTranslation = [gesture translationInView:self];
|
||||||
|
|
||||||
|
{
|
||||||
short translationDeltaY = currentScrollTranslation.y - lastScrollTranslation.y;
|
short translationDeltaY = currentScrollTranslation.y - lastScrollTranslation.y;
|
||||||
if (translationDeltaY != 0) {
|
if (translationDeltaY != 0) {
|
||||||
LiSendScrollEvent(translationDeltaY > 0 ? 1 : -1);
|
LiSendScrollEvent(translationDeltaY > 0 ? 1 : -1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
short translationDeltaX = currentScrollTranslation.x - lastScrollTranslation.x;
|
||||||
|
if (translationDeltaX != 0) {
|
||||||
|
// Direction is reversed from vertical scrolling
|
||||||
|
LiSendHScrollEvent(translationDeltaX < 0 ? 1 : -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lastScrollTranslation = currentScrollTranslation;
|
lastScrollTranslation = currentScrollTranslation;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user