@@ -65,7 +65,7 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
6565 private var lastDragY: Float = 0.0f
6666
6767 override fun onDown (event : MotionEvent ): Boolean {
68- GodotInputHandler .handleMotionEvent(event.source , MotionEvent .ACTION_DOWN , event.buttonState, event.x, event.y , nextDownIsDoubleTap)
68+ GodotInputHandler .handleMotionEvent(event, MotionEvent .ACTION_DOWN , nextDownIsDoubleTap)
6969 nextDownIsDoubleTap = false
7070 return true
7171 }
@@ -85,20 +85,14 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
8585 }
8686
8787 // Cancel the previous down event
88- GodotInputHandler .handleMotionEvent(
89- event.source,
90- MotionEvent .ACTION_CANCEL ,
91- event.buttonState,
92- event.x,
93- event.y
94- )
88+ GodotInputHandler .handleMotionEvent(event, MotionEvent .ACTION_CANCEL )
9589
9690 // Turn a context click into a single tap right mouse button click.
9791 GodotInputHandler .handleMouseEvent(
92+ event,
9893 MotionEvent .ACTION_DOWN ,
9994 MotionEvent .BUTTON_SECONDARY ,
100- event.x,
101- event.y
95+ false
10296 )
10397 contextClickInProgress = true
10498 }
@@ -110,16 +104,7 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
110104
111105 if (! hasCapture) {
112106 // Dispatch a mouse relative ACTION_UP event to signal the end of the capture
113- GodotInputHandler .handleMouseEvent(
114- MotionEvent .ACTION_UP ,
115- 0 ,
116- 0f ,
117- 0f ,
118- 0f ,
119- 0f ,
120- false ,
121- true
122- )
107+ GodotInputHandler .handleMouseEvent(MotionEvent .ACTION_UP , true )
123108 }
124109 pointerCaptureInProgress = hasCapture
125110 }
@@ -142,26 +127,11 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
142127 return true
143128 }
144129
145- val sourceMouseRelative = if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
146- event.isFromSource(InputDevice .SOURCE_MOUSE_RELATIVE )
147- } else {
148- false
149- }
150-
151130 if (pointerCaptureInProgress || dragInProgress || contextClickInProgress) {
152131 if (contextClickInProgress || GodotInputHandler .isMouseEvent(event)) {
153132 // This may be an ACTION_BUTTON_RELEASE event which we don't handle,
154133 // so we convert it to an ACTION_UP event.
155- GodotInputHandler .handleMouseEvent(
156- MotionEvent .ACTION_UP ,
157- event.buttonState,
158- event.x,
159- event.y,
160- 0f ,
161- 0f ,
162- false ,
163- sourceMouseRelative
164- )
134+ GodotInputHandler .handleMouseEvent(event, MotionEvent .ACTION_UP )
165135 } else {
166136 GodotInputHandler .handleTouchEvent(event)
167137 }
@@ -178,21 +148,7 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
178148
179149 private fun onActionMove (event : MotionEvent ): Boolean {
180150 if (contextClickInProgress) {
181- val sourceMouseRelative = if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
182- event.isFromSource(InputDevice .SOURCE_MOUSE_RELATIVE )
183- } else {
184- false
185- }
186- GodotInputHandler .handleMouseEvent(
187- event.actionMasked,
188- MotionEvent .BUTTON_SECONDARY ,
189- event.x,
190- event.y,
191- 0f ,
192- 0f ,
193- false ,
194- sourceMouseRelative
195- )
151+ GodotInputHandler .handleMouseEvent(event, event.actionMasked, MotionEvent .BUTTON_SECONDARY , false )
196152 return true
197153 } else if (! scaleInProgress) {
198154 // The 'onScroll' event is triggered with a long delay.
@@ -213,7 +169,7 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
213169 if (event.actionMasked == MotionEvent .ACTION_UP ) {
214170 nextDownIsDoubleTap = false
215171 GodotInputHandler .handleMotionEvent(event)
216- } else if (event.actionMasked == MotionEvent .ACTION_MOVE && panningAndScalingEnabled == false ) {
172+ } else if (event.actionMasked == MotionEvent .ACTION_MOVE && ! panningAndScalingEnabled) {
217173 GodotInputHandler .handleMotionEvent(event)
218174 }
219175
@@ -235,13 +191,7 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
235191 if (dragInProgress || lastDragX != 0.0f || lastDragY != 0.0f ) {
236192 if (originEvent != null ) {
237193 // Cancel the drag
238- GodotInputHandler .handleMotionEvent(
239- originEvent.source,
240- MotionEvent .ACTION_CANCEL ,
241- originEvent.buttonState,
242- originEvent.x,
243- originEvent.y
244- )
194+ GodotInputHandler .handleMotionEvent(originEvent, MotionEvent .ACTION_CANCEL )
245195 }
246196 dragInProgress = false
247197 lastDragX = 0.0f
0 commit comments