commit 517f9fb91f6fc0362c68e93ece892c9ecfbe6e0c
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed Mar 11 12:01:02 2020 +0000

    Improve the way we handle the cube.
    Before if we touched the screen during any of the transitions, this touch and resulting draw would result in no action (confusing).
    Now it seamlessly becomes a drag (even if we, during a transition, touched inside the cube)

diff --git a/src/main/java/org/distorted/magic/RubikSurfaceView.java b/src/main/java/org/distorted/magic/RubikSurfaceView.java
index 25d3c775..2c668c93 100644
--- a/src/main/java/org/distorted/magic/RubikSurfaceView.java
+++ b/src/main/java/org/distorted/magic/RubikSurfaceView.java
@@ -238,7 +238,7 @@ public class RubikSurfaceView extends GLSurfaceView
                                        Static4D rotatedTouchPoint1= rotateVectorByInvertedQuat(touchPoint1, mQuatAccumulated);
                                        Static4D rotatedCamera= rotateVectorByInvertedQuat(CAMERA_POINT, mQuatAccumulated);
 
-                                       if( mMovement.faceTouched(rotatedTouchPoint1,rotatedCamera) )
+                                       if( mMovement!=null && mMovement.faceTouched(rotatedTouchPoint1,rotatedCamera) )
                                          {
                                          mDragging           = false;
                                          mBeginningRotation  = mRenderer.canRotate();
@@ -251,22 +251,7 @@ public class RubikSurfaceView extends GLSurfaceView
                                          mContinuingRotation = false;
                                          }
                                        break;
-         case MotionEvent.ACTION_MOVE: if( mDragging )
-                                         {
-                                         mTempCurrent.set(quatFromDrag(mX-x,y-mY));
-                                         mRenderer.setQuatCurrentOnNextRender();
-
-                                         if( (mX-x)*(mX-x) + (mY-y)*(mY-y) > 1.0f/(DIRECTION_SENSITIVITY*DIRECTION_SENSITIVITY) )
-                                           {
-                                           mX = x;
-                                           mY = y;
-                                           mTempAccumulated.set(quatMultiply(mQuatCurrent, mQuatAccumulated));
-                                           mTempCurrent.set(0f, 0f, 0f, 1f);
-                                           mRenderer.setQuatCurrentOnNextRender();
-                                           mRenderer.setQuatAccumulatedOnNextRender();
-                                           }
-                                         }
-                                       if( mBeginningRotation )
+         case MotionEvent.ACTION_MOVE: if( mBeginningRotation )
                                          {
                                          if( (mX-x)*(mX-x)+(mY-y)*(mY-y) > 1.0f/(ROTATION_SENSITIVITY*ROTATION_SENSITIVITY) )
                                            {
@@ -296,6 +281,22 @@ public class RubikSurfaceView extends GLSurfaceView
                                          float angle = mMovement.continueRotation(rotatedTouchPoint3);
                                          mRenderer.getObject().continueRotation(SWIPING_SENSITIVITY*angle);
                                          }
+                                       else if( mDragging || mRenderer.canDrag() )
+                                         {
+                                         mDragging = true;
+                                         mTempCurrent.set(quatFromDrag(mX-x,y-mY));
+                                         mRenderer.setQuatCurrentOnNextRender();
+
+                                         if( (mX-x)*(mX-x) + (mY-y)*(mY-y) > 1.0f/(DIRECTION_SENSITIVITY*DIRECTION_SENSITIVITY) )
+                                           {
+                                           mX = x;
+                                           mY = y;
+                                           mTempAccumulated.set(quatMultiply(mQuatCurrent, mQuatAccumulated));
+                                           mTempCurrent.set(0f, 0f, 0f, 1f);
+                                           mRenderer.setQuatCurrentOnNextRender();
+                                           mRenderer.setQuatAccumulatedOnNextRender();
+                                           }
+                                         }
                                        break;
          case MotionEvent.ACTION_UP  : if( mDragging )
                                          {
