File tree Expand file tree Collapse file tree 2 files changed +19
-13
lines changed
plugin/platforms/android/java/com/swmansion/gesturehandler Expand file tree Collapse file tree 2 files changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -51,27 +51,29 @@ public PinchGestureHandler() {
5151
5252 @ Override
5353 protected void onHandle (MotionEvent event ) {
54+ int activePointers = event .getPointerCount ();
5455
5556 if (getState () == STATE_UNDETERMINED ) {
56- Context context = getView ().getContext ();
57- mLastVelocity = 0f ;
58- mLastScaleFactor = 1f ;
59- mScaleGestureDetector = new ScaleGestureDetector (context , mGestureListener );
60- if (mSpanSlop != -1 ) {
61- mScaleGestureDetector .setSpanSlop (mSpanSlop );
62- }
63- if (mMinSpan != -1 ) {
64- mScaleGestureDetector .setMinSpan (mMinSpan );
57+ if (mScaleGestureDetector == null ) {
58+ Context context = getView ().getContext ();
59+ mLastVelocity = 0f ;
60+ mLastScaleFactor = 1f ;
61+ mScaleGestureDetector = new ScaleGestureDetector (context , mGestureListener );
62+ if (mSpanSlop != -1 ) {
63+ mScaleGestureDetector .setSpanSlop (mSpanSlop );
64+ }
65+ if (mMinSpan != -1 ) {
66+ mScaleGestureDetector .setMinSpan (mMinSpan );
67+ }
6568 }
66-
6769 begin ();
6870 }
71+
6972
7073 if (mScaleGestureDetector != null ) {
7174 mScaleGestureDetector .onTouchEvent (event );
7275 }
7376
74- int activePointers = event .getPointerCount ();
7577 if (event .getActionMasked () == MotionEvent .ACTION_POINTER_UP ) {
7678 activePointers -= 1 ;
7779 }
Original file line number Diff line number Diff line change @@ -44,12 +44,16 @@ public RotationGestureHandler() {
4444 @ Override
4545 protected void onHandle (MotionEvent event ) {
4646 int state = getState ();
47+ int activePointers = event .getPointerCount ();
4748 if (state == STATE_UNDETERMINED ) {
4849 mLastVelocity = 0f ;
4950 mLastRotation = 0f ;
50- mRotationGestureDetector = new RotationGestureDetector (mGestureListener );
51+ if (mRotationGestureDetector == null ) {
52+ mRotationGestureDetector = new RotationGestureDetector (mGestureListener );
5153
52- begin ();
54+ }
55+
56+ begin ();
5357 }
5458
5559 if (mRotationGestureDetector != null ) {
You can’t perform that action at this time.
0 commit comments