Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,13 @@ class PinchGestureHandler : GestureHandler<PinchGestureHandler>() {
this.focalPointX = point.x
this.focalPointY = point.y
}
var activePointers = sourceEvent.pointerCount
if (sourceEvent.actionMasked == MotionEvent.ACTION_POINTER_UP) {
activePointers -= 1
}
if (state == STATE_ACTIVE && activePointers < 2) {
end()
} else if (sourceEvent.actionMasked == MotionEvent.ACTION_UP) {
fail()

if (sourceEvent.actionMasked == MotionEvent.ACTION_UP) {
if (state == STATE_ACTIVE) {
end()
} else {
fail()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,21 @@ class RotationGestureDetector(private val gestureListener: OnRotationGestureList
updateCurrent(event)
gestureListener?.onRotation(this)
}
MotionEvent.ACTION_POINTER_UP -> if (isInProgress) {
MotionEvent.ACTION_POINTER_UP -> {
val pointerId = event.getPointerId(event.actionIndex)
if (pointerId == pointerIds[0] || pointerId == pointerIds[1]) {
// One of the key pointer has been lifted up, we have to end the gesture
finish()

// All key pointers are up
if (!isInProgress && pointerId == pointerIds[0]) {
gestureListener?.onRotationEnd(this)
}

// One of the key pointers is up
if (isInProgress && pointerIds.contains(pointerId)) {
if (pointerId == pointerIds[0]) {
pointerIds[0] = pointerIds[1]
}
pointerIds[1] = MotionEvent.INVALID_POINTER_ID
isInProgress = false
}
Comment thread
j-piasecki marked this conversation as resolved.
}
MotionEvent.ACTION_UP -> finish()
Expand Down