@@ -485,27 +485,28 @@ static boolean handleMouseEvent(final MotionEvent event) {
485
485
final float y = event .getY ();
486
486
final int buttonsMask = event .getButtonState ();
487
487
488
- float verticalFactor = 0 ;
489
- float horizontalFactor = 0 ;
490
-
491
- // If event came from RotaryEncoder (Bezel or Crown rotate event on Wear OS smart watches),
492
- // convert it to mouse wheel event.
493
- if (event .isFromSource (InputDevice .SOURCE_ROTARY_ENCODER )) {
494
- if (rotaryInputAxis == ROTARY_INPUT_HORIZONTAL_AXIS ) {
495
- horizontalFactor = -event .getAxisValue (MotionEvent .AXIS_SCROLL );
496
- } else {
497
- // If rotaryInputAxis is not ROTARY_INPUT_HORIZONTAL_AXIS then use default ROTARY_INPUT_VERTICAL_AXIS axis.
498
- verticalFactor = -event .getAxisValue (MotionEvent .AXIS_SCROLL );
499
- }
500
- } else {
501
- verticalFactor = event .getAxisValue (MotionEvent .AXIS_VSCROLL );
502
- horizontalFactor = event .getAxisValue (MotionEvent .AXIS_HSCROLL );
488
+ float verticalFactor = event .getAxisValue (MotionEvent .AXIS_VSCROLL );
489
+ float horizontalFactor = event .getAxisValue (MotionEvent .AXIS_HSCROLL );
490
+ float pressure = event .getPressure ();
491
+ float tiltX = event .getAxisValue (MotionEvent .AXIS_TILT_X );
492
+ float tiltY = event .getAxisValue (MotionEvent .AXIS_TILT_Y );
493
+
494
+ // Check if the event has tilt data
495
+ if (Float .isNaN (tiltX ) || Float .isNaN (tiltY )) {
496
+ tiltX = 0 ; // Default value if tilt data is not available
497
+ tiltY = 0 ; // Default value if tilt data is not available
503
498
}
499
+
500
+ // Check if the event has pressure data
501
+ if (Float .isNaN (pressure )) {
502
+ pressure = 1 ; // Default value if pressure data is not available
503
+ }
504
+
504
505
boolean sourceMouseRelative = false ;
505
506
if (android .os .Build .VERSION .SDK_INT >= android .os .Build .VERSION_CODES .O ) {
506
507
sourceMouseRelative = event .isFromSource (InputDevice .SOURCE_MOUSE_RELATIVE );
507
508
}
508
- return handleMouseEvent (eventAction , buttonsMask , x , y , horizontalFactor , verticalFactor , false , sourceMouseRelative );
509
+ return handleMouseEvent (eventAction , buttonsMask , x , y , horizontalFactor , verticalFactor , pressure , tiltX , tiltY , false , sourceMouseRelative );
509
510
}
510
511
511
512
static boolean handleMouseEvent (int eventAction , int buttonsMask , float x , float y ) {
@@ -551,6 +552,11 @@ static boolean handleMouseEvent(int eventAction, int buttonsMask, float x, float
551
552
return false ;
552
553
}
553
554
555
+ static boolean handleMouseEvent (int eventAction , int buttonsMask , float x , float y , float deltaX , float deltaY , float pressure , float tiltX , float tiltY , boolean doubleClick , boolean sourceMouseRelative ) {
556
+ GodotLib .dispatchMouseEvent (eventAction , buttonsMask , x , y , deltaX , deltaY , pressure , tiltX , tiltY , doubleClick , sourceMouseRelative );
557
+ return true ;
558
+ }
559
+
554
560
static boolean handleTouchEvent (final MotionEvent event ) {
555
561
final int pointerCount = event .getPointerCount ();
556
562
if (pointerCount == 0 ) {
0 commit comments