Skip to content
Open
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 @@ -13,6 +13,8 @@ class PinchGestureHandler : GestureHandler<PinchGestureHandler>() {
private set
val focalPointX: Float
get() = scaleGestureDetector?.focusX ?: Float.NaN
var activePointers = 0
private set
val focalPointY: Float
get() = scaleGestureDetector?.focusY ?: Float.NaN

Expand Down Expand Up @@ -60,11 +62,11 @@ class PinchGestureHandler : GestureHandler<PinchGestureHandler>() {
begin()
}
scaleGestureDetector?.onTouchEvent(event)
var activePointers = event.pointerCount
activePointers = event.pointerCount
if (event.actionMasked == MotionEvent.ACTION_POINTER_UP) {
activePointers -= 1
}
if (state == STATE_ACTIVE && activePointers < 2) {
if (state == STATE_ACTIVE && event.actionMasked == MotionEvent.ACTION_UP) {
end()
} else if (event.actionMasked == MotionEvent.ACTION_UP) {
fail()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ class RNGestureHandlerModule(reactContext: ReactApplicationContext?)
putDouble("focalX", PixelUtil.toDIPFromPixel(handler.focalPointX).toDouble())
putDouble("focalY", PixelUtil.toDIPFromPixel(handler.focalPointY).toDouble())
putDouble("velocity", handler.velocity)
putDouble("numberOfPointers", handler.activePointers.toDouble())
}
}
}
Expand Down