Skip to content

Commit 7856646

Browse files
committed
Add comment
1 parent f7c9190 commit 7856646

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ open class GestureHandler<ConcreteGestureHandlerT : GestureHandler<ConcreteGestu
6969
private var onTouchEventListener: OnTouchEventListener? = null
7070
private var interactionController: GestureHandlerInteractionController? = null
7171

72+
// a field to store a motion event that caused the touch event to be dispatched, in case the state
73+
// change is triggered in the callback, this event will be used to initialize the gesture
7274
private var eventTriggeringStateChangeInTouchEventHandler: MotionEvent? = null
7375

7476
@Suppress("UNCHECKED_CAST")
@@ -461,17 +463,17 @@ open class GestureHandler<ConcreteGestureHandlerT : GestureHandler<ConcreteGestu
461463
eventTriggeringStateChangeInTouchEventHandler = sourceEvent
462464

463465
when (event.actionMasked) {
464-
MotionEvent.ACTION_DOWN, MotionEvent.ACTION_POINTER_DOWN -> {
465-
handleTouchDownEvent(event)
466-
handleTouchMoveEvent(event)
467-
}
468-
MotionEvent.ACTION_UP, MotionEvent.ACTION_POINTER_UP -> {
469-
handleTouchMoveEvent(event)
470-
handleTouchUpEvent(event)
471-
}
472-
MotionEvent.ACTION_MOVE -> {
473-
handleTouchMoveEvent(event)
474-
}
466+
MotionEvent.ACTION_DOWN, MotionEvent.ACTION_POINTER_DOWN -> {
467+
handleTouchDownEvent(event)
468+
handleTouchMoveEvent(event)
469+
}
470+
MotionEvent.ACTION_UP, MotionEvent.ACTION_POINTER_UP -> {
471+
handleTouchMoveEvent(event)
472+
handleTouchUpEvent(event)
473+
}
474+
MotionEvent.ACTION_MOVE -> {
475+
handleTouchMoveEvent(event)
476+
}
475477
}
476478

477479
eventTriggeringStateChangeInTouchEventHandler = null

0 commit comments

Comments
 (0)