mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-20 23:40:17 +00:00
Implement horizontal scrolling for Apple TV
This commit is contained in:
@@ -33,6 +33,7 @@ static const double MOUSE_SPEED_DIVISOR = 1.25;
|
|||||||
|
|
||||||
float accumulatedDeltaX;
|
float accumulatedDeltaX;
|
||||||
float accumulatedDeltaY;
|
float accumulatedDeltaY;
|
||||||
|
float accumulatedScrollX;
|
||||||
float accumulatedScrollY;
|
float accumulatedScrollY;
|
||||||
|
|
||||||
OnScreenControls *_osc;
|
OnScreenControls *_osc;
|
||||||
@@ -455,6 +456,18 @@ static const double MOUSE_SPEED_DIVISOR = 1.25;
|
|||||||
// in iPadOS 15 where discrete scroll events are dropped. tvOS only supports
|
// in iPadOS 15 where discrete scroll events are dropped. tvOS only supports
|
||||||
// GCMouse for mice, so we will have to just use it and hope for the best.
|
// GCMouse for mice, so we will have to just use it and hope for the best.
|
||||||
#if TARGET_OS_TV
|
#if TARGET_OS_TV
|
||||||
|
mouse.mouseInput.scroll.xAxis.valueChangedHandler = ^(GCControllerAxisInput * _Nonnull axis, float value) {
|
||||||
|
self->accumulatedScrollX += value;
|
||||||
|
|
||||||
|
short truncatedScrollX = (short)self->accumulatedScrollX;
|
||||||
|
|
||||||
|
if (truncatedScrollX != 0) {
|
||||||
|
// Direction is reversed from vertical scrolling
|
||||||
|
LiSendHighResHScrollEvent(-truncatedScrollX * 20);
|
||||||
|
|
||||||
|
self->accumulatedScrollX -= truncatedScrollX;
|
||||||
|
}
|
||||||
|
};
|
||||||
mouse.mouseInput.scroll.yAxis.valueChangedHandler = ^(GCControllerAxisInput * _Nonnull axis, float value) {
|
mouse.mouseInput.scroll.yAxis.valueChangedHandler = ^(GCControllerAxisInput * _Nonnull axis, float value) {
|
||||||
self->accumulatedScrollY += value;
|
self->accumulatedScrollY += value;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user